Contributions
Getting all Test Cycles Rest API
Hi, I want to get all the Test Cycle with the REST API # BASE URL for Zephyr for Jira Cloud BASE_URL = 'https://prod-api.zephyr4jiracloud.com/connect' # RELATIVE PATH for token generation and make request to api RELATIVE_PATH = '/public/rest/api/1.0/cycles/search' # QUERY STRING for API QUERY_STRING = "versionId=1&projectId=10102" # CANONICAL PATH (Http Method & Relative Path & Query String) CANONICAL_PATH = 'GET&'+ RELATIVE_PATH + '&' +QUERY_STRING # TOKEN HEADER: to generate jwt token payload_token = { 'sub': ACCOUNT_ID, 'qsh': hashlib.sha256(CANONICAL_PATH.encode('utf-8')).hexdigest(), 'iss': ACCESS_KEY, 'exp': int(time.time())+JWT_EXPIRE, 'iat': int(time.time()) } # GENERATE TOKEN token = jwt.encode(payload_token, SECRET_KEY, algorithm='HS256').strip() #.decode('utf-8') print(token) # REQUEST HEADER: to authenticate and authorize api headers = { 'Authorization': 'JWT '+token, 'Content-Type': 'application/json', 'zapiAccessKey': ACCESS_KEY } # MAKE REQUEST: print(BASE_URL + RELATIVE_PATH + '?' + QUERY_STRING) raw_result = requests.get(BASE_URL + RELATIVE_PATH + '?' + QUERY_STRING, headers=headers) These are the results: { "clientMessage": "Invalid Json", "errorCode": 151, "errorType": "ERROR" } Any ideas?284Views0likes0Comments