Forum Discussion

  • tribeiro's avatar
    tribeiro
    SmartBear Alumni (Retired)
    Antonio,

    Do you get the same error by using an API client like Postman? Also what method are you using?
    Can you share an example of your Python Script?
    • Antonio12's avatar
      Antonio12
      New Contributor
      ACCESS_KEY = "your token here"
      ZEPHYR_URL = "https://api.adaptavist.io/tm4j/v2/testcycles"
      def check():
      headers = {
      "Accept": "application/json",
      "Content-Type": "application/json",
      "Authorization": f"Bearer {ACCESS_KEY}"
      }
      test_cycle_info = json.dumps({
      "projectKey": 48458,
      "name": "Testing Cycle",
      "description": "Smoke test cycle for the weekly release",
      "jiraProjectVersion": "UI:tag_name",
      "plannedStartDate": "2021-03-04T13:36:56Z",
      "plannedEndDate": "2021-03-06T13:36:56Z"
      })
      resp = requests.request(
      "POST",
      f"{ZEPHYR_URL}",
      data=test_cycle_info,
      headers=headers
      )
      if resp.status_code == 200:
      print(resp.text)
      else:
      print(resp.text, resp.status_code)


      if __name__ == '__main__':
      check()
      • jfelix's avatar
        jfelix
        SmartBear Alumni (Retired)

        Hi, Antonio12! Thanks for sharing your script.

         

        Based on it, it looks like you're trying to pass an integer as the projectKey - it should be a string; also, you're passing a string as the jiraProjectVersion but it should be an integer, representing the ID of that project version.

         

        Can you please try it again with those changes?