Forum Discussion

Vallalarasu_P's avatar
Vallalarasu_P
Frequent Contributor
3 years ago

How to Create a Zephyr Scale API for my Organization ?

Hi Team,

 

I've Zephyr Scale - Cloud integrated with my Jira instance. I wish to access the Zephyr Scale Cloud using API. Can you provide the step to access the same.

 

Can i access my org zephyr scale using the same API - "https://api.zephyrscale.smartbear.com/v2" ?  and only the bearer token changes ? . 

 

Please comment, If my API must be customized ?

 

Also, how to i access these API using ReadyAPI/SoapUI/Postman. 

 

 

 

 

 Regards

Valla

  • Found the Solution and its working.

     

    To access the API in ReadyAPI/Postman - We need to use the yml file  ( api.cloud.expanded.yml) from API Documentation (https://support.smartbear.com/zephyr-scale-cloud/api-docs/) with authorization token for ZephyrScale Cloud API - Access token from Jira.

     

    To Access from TestComplete, The below code works.

     

    Sub ZephyrScaleAPI_TestComplete
    'Definitions
    API_Address_Endpoint = "https://api.zephyrscale.smartbear.com/v2/projects/?maxResults=10&startAt=0"
    CurrentToken = "Update your token" "
    Log.Message ("API_Address_EndPoint: " + API_Address_Endpoint)
    Log.Message ("CurrentToken: "+ CurrentToken)

    'Calling Rest API
    Set aqHttpRequest = aqHttp.CreateGetRequest(API_Address_Endpoint)
    Call aqHttpRequest.SetHeader("Authorization","Bearer " + CurrentToken)
    'Call aqHttpRequest.SetTimeouts(50000,70000,50000,70000)
    Set aqHttpResponse = aqHttpRequest.Send()

    'Getting Reponses
    If Not aqHttpResponse Is Nothing Then
    Log.Message("All Headers : " + aqHttpResponse.AllHeaders)
    Log.Message("A specific header : " + aqHttpResponse.GetHeader("Content-Type"))
    Log.Message("Status Code : " + aqHttpResponse.StatusCode)
    Log.Message("Status Text : " + aqHttpResponse.StatusText)
    Log.Message("Respone Body : "+ aqHttpResponse.Text)
    aqHttpResponse.SaveToFile(Project.Path & "body.txt")
    End If
    End Sub

     

    Sample Respone File :

     

    {"next":null,"startAt":0,"maxResults":3,"total":3,"isLast":true,"values":[{"id":12345,"jiraProjectId":54321,"key":"abc","enabled":true},{"id":12346,"jiraProjectId":54322,"key":"ABCDEF","enabled":false},{"id":12347,"jiraProjectId":54323,"key":"ABCD","enabled":false}]}

     

     

     

  • Vallalarasu_P's avatar
    Vallalarasu_P
    Frequent Contributor

    Found the Solution and its working.

     

    To access the API in ReadyAPI/Postman - We need to use the yml file  ( api.cloud.expanded.yml) from API Documentation (https://support.smartbear.com/zephyr-scale-cloud/api-docs/) with authorization token for ZephyrScale Cloud API - Access token from Jira.

     

    To Access from TestComplete, The below code works.

     

    Sub ZephyrScaleAPI_TestComplete
    'Definitions
    API_Address_Endpoint = "https://api.zephyrscale.smartbear.com/v2/projects/?maxResults=10&startAt=0"
    CurrentToken = "Update your token" "
    Log.Message ("API_Address_EndPoint: " + API_Address_Endpoint)
    Log.Message ("CurrentToken: "+ CurrentToken)

    'Calling Rest API
    Set aqHttpRequest = aqHttp.CreateGetRequest(API_Address_Endpoint)
    Call aqHttpRequest.SetHeader("Authorization","Bearer " + CurrentToken)
    'Call aqHttpRequest.SetTimeouts(50000,70000,50000,70000)
    Set aqHttpResponse = aqHttpRequest.Send()

    'Getting Reponses
    If Not aqHttpResponse Is Nothing Then
    Log.Message("All Headers : " + aqHttpResponse.AllHeaders)
    Log.Message("A specific header : " + aqHttpResponse.GetHeader("Content-Type"))
    Log.Message("Status Code : " + aqHttpResponse.StatusCode)
    Log.Message("Status Text : " + aqHttpResponse.StatusText)
    Log.Message("Respone Body : "+ aqHttpResponse.Text)
    aqHttpResponse.SaveToFile(Project.Path & "body.txt")
    End If
    End Sub

     

    Sample Respone File :

     

    {"next":null,"startAt":0,"maxResults":3,"total":3,"isLast":true,"values":[{"id":12345,"jiraProjectId":54321,"key":"abc","enabled":true},{"id":12346,"jiraProjectId":54322,"key":"ABCDEF","enabled":false},{"id":12347,"jiraProjectId":54323,"key":"ABCD","enabled":false}]}