Forum Discussion

Talsht's avatar
Talsht
New Contributor
4 years ago
Solved

Zephyr Cloud API - automated creation of execution

Dear Community,

I'm new to Zephyr cloud so pardon is the issue seems obvious to you.

 

I've been using the ZAPI to certain endpoints as described in the documentation so far successfully but encountered a problem with some.

 

A most import feature we would like to implement is automated creation/update of test execution, not by a test manager, but ourselves using the code itself at the SetUp/TearDown stages of the test.

For this end I've been using the "Create Execution" and "Update Execution" APIs.

 

I was using them them same way I've been using the other endpoints and according to the documentation, but for the execution creation I have been receiving an error:

 

Internal Server Error{"errorType":"ERROR","clientMessage":"We encountered some problems during processing this request. Please try again!","errorCode":104}

 

Searching the web I've seen this error has risen more than a couple of times and probably having something to do with the JWT generation but I'm not certain of that as i've followed the instruction for JWT generation to the letter.

 

the URL for request (GET):

https://prod-api.zephyr4jiracloud.com/connect/public/rest/api/1.0/execution

 

request headers:

{
"Authorization": "JWT eyJ0...Xu0I",
"Content-Type": "application/json",
"zapiAccessKey": <Zephyr access key>
}

 

request body (json):

{"status": {"id": 1}, "projectId": <project_id>, "issueId": <issue_id>, "versionId": <version_id>}

 

having said that, I must emphasize that the update execution API does indeed work when manually creating the execution using the UI and just updated the execution with the executionId. 

 

Sincerely hoping for some intake on that.

 

edit: neglected to mention that trying to use the "try it now" console option from the official documentation  with the example body and default headers, yields the exact same results -  error 104 (https://zfjcloud.docs.apiary.io/#reference/execution/add-tests-to-folder/create-execution?console=1)

 

 

 

 

  • Talsht 

     

    Please update delete and regenerate the api keys and give it a try.

    Also please send the data as  raw >>JSON, it should do the trick. 

     

    If you are still facing the same issue please feel free to create a support case and we will be happy to help you!

     

    -Bibek

     

6 Replies

  • BibekBehera's avatar
    BibekBehera
    SmartBear Alumni (Retired)

    Talsht 

     

    Please update delete and regenerate the api keys and give it a try.

    Also please send the data as  raw >>JSON, it should do the trick. 

     

    If you are still facing the same issue please feel free to create a support case and we will be happy to help you!

     

    -Bibek

     

    • Talsht's avatar
      Talsht
      New Contributor

      Hey,

      thank you for your reply.

      Sorry for the delay, I was away for the holidays.

       

      Well I tried following your solution and to delete and reapply a new key and to send as a raw json.

      I did not work however and I got the exact same result.

       

      What did work was adding the cycleId in the request data itself.

      From the documentation the cycleId is optional in the cloud API, however in the server API the cycleId is mandatory so this is where I got the inspiration to try it here as well.

       

      did not work:

      request = {"status": status, "projectId": project_id, "issueId": issue_id, "versionId": version_id}

      did work:

      request = {"status": status, "projectId": project_id, "issueId": issue_id, "versionId": version_id, "cycleId": "-1"}

       

      This has indeed solved the problem and you can now close the post.

       

      I do strongly suggest updating the documentation to reflect that the cycleId is indeed mandatory and not optional (or maybe change the request validation so the response is not an ambigious internal server error...)

       

      Sincerely,

      • gat-bryszard's avatar
        gat-bryszard
        New Contributor

        We've encountered the same problem and your solution resolved it Talsht, thank you!

        +1 to updating the docs, guys.