1. Home
  2. Opkey Help
  3. 26. Advanced Opkey Usage
  4. 26.21 Using OpKey APIs to get execution result in Json

26.21 Using OpKey APIs to get execution result in Json

Overview

An application program interface (API) is a set of subroutine definitions, communication protocols that allow two software programs to communicate with each other. There are few new APIs in the OpKey which allows OpKey users to get the execution result of their executed Test Cases and without accessing OpKey directly by using API Tools like Postman & SoapUI.

OpKey users can now use OpKey APIs to get the execution result of Test Case and Suites without directly accessing the OpKey Web user interface.

The Need of OpKey APIs

APIs work as a bridge of communication between two applications over a network. If an OpKey user wants to get details of the execution result of Test Cases and Suites then he/she can use these APIs with an API Tool like Postman & SoapUI. These APIs are

  1. Authorize
  2. GetSuiteResult
  3. GetTestCaseResult

Getting started with OpKey APIs

Let us start using the OpKey APIs on Postman API Tool to get the execution result details about the executed Test Case and Suites. An API URI composed of URL (OpKey Web domain URL), with Resource Path & Query Parameter i.e.

API URI = URL + Resource_Path + Query_Parameter

Note: Some API URIs don’t contain Query Parameters.

(1) Authorize

This API is used to get the Authorization Token by using the Username and Password of OpKey Web using the POST method.

If OpKey Web domain URL is https://www.xyz.myopkey.com then…

  • API URI (Variable): https://www.xyz.myopkey.com/api/OpkeyAuth/authorize
  • Resource Path (Static): /api/OpkeyAuth/authorize
  • There is no Query Parameter

Note: Here, the API URI depends on the OpKey Web domain name.

  • Select the Post Method and enter the API URL, go to the Authorization tab and enter OpKey Username and Password and then click on Send to get the Authorization Token.
  • The Authorization Token has been fetched which can be used in further APIs as input.

(2) GetSuiteResult

This API fetches the details about the execution result of Suite in Json format. This API takes few Query Parameters and Authorization Tokens as input using Get Method.

If OpKey Web domain URL is https://www.xyz.myopkey.com then…

  • API URI (Variable): https://www.xyz.myopkey.com/api/OpkeyRestV2/GetSuiteResult?ProjectName=NameOfProject&BuildName=NameOfBuild&SessionName=NameOfExecutionSession
  • Resource Path (Static): /api/OpkeyRestV2/GetSuiteResult
  • Query Parameter (Variable): ?ProjectName=NameOfProject&BuildName=NameOfBuild&SessionName=NameOfExecutionSession

Note: Here, the API URI and Query Parameters are variable in nature which depend on your Project, Build, Session etc.

  • Select the Get Method & enter the API URL, go to the Params tab and enter Query Parameters like ProjectName, BuildName & SessionName.

  • Go to the Authorization tab and enter the Authorization Token and then click on Send to run the Get Method and fetch execution result.
  • Here, you can have a look at the Suite Execution Result details in Json format under the Body tab.

 

(3) GetTestCaseResult

This API fetches the details about the execution result of the Test Case in Suite. This API takes few Query Parameters and Authorization Tokens as input using Get Method. You need to run the GetSuiteResult API in order to get the Test Case Step ID which is required as a Query Parameter in this API (GetTestCaseResult) for getting the Test Case Result.

If OpKey Web domain URL is https://www.xyz.myopkeycom then…

  • API URI (Variable): https://www.xyz.myopkey.com/api/OpkeyRestV2/GetTestCaseResult?ProjectName=NameOfProject&BuildName=NameOfBuild&SessionName=NameOfExecutionSession&TestCaseStepID=IDOfYourTestCaseStep
  • Resource Path (Static): /api/OpkeyRestV2/GetTestCaseResult
  • Query Parameter (Variable): ?ProjectName=NameOfProject&BuildName=NameOfBuild&SessionName=NameOfExecutionSession&TestCaseStepID=IDOfYourTestCaseStep

Note: Here, the API URI and Query Parameters are variable in nature which depend on your Project, Build, Session, Test Case Step ID etc.

  • Select the Get Method & enter the API URL, go to the Params tab and enter Query Parameters like ProjectName, BuildName, SessionName & TestCaseStepID.

  • Go to the Authorization tab and enter the Authorization Token and then click on Send to run the Get Method and fetch execution result.
  • Here, you can have a look at the Test Case Execution Result details in Json format under the Body tab.

Thus, you don’t need to access the OpKey Web to get the test case or Suite execution result. You can use these above-mentioned APIs to do get the test case or Suite execution result details.

(4) GetAllSessionsOfABuild

This API is used to get all the sessions from an executed build. This API takes a few Query Parameters and Authorization Token as input using GET Method. 

If the OpKey Web Domain URL is  https://www.xyz.myopkey.com then… 

API URI (Variable) – https://xyz.smartopkey.com/api/OpkeyRestV2/GetAllSessions?ProjectName=NameofProject&BuildName=NameofBuild

Resource Path (Static) /api/OpkeyRestV2/GetAllSessions

Query Parameter (Variable) : ? ProjectName=NameofProject&BuildName=NameofBuild

NOTE : Here the API URI and Query Parameters are variable in nature which depends on your Project and Build Name.

  • Select the “GET Method” and enter the API URL, go to the “Params” Tab and enter query parameters like Project Name and Build Name

  • Go to the “Authorization” Tab and enter the Authorization Token, and click on the “Send” button to run the Get method and fetch the execution result. 

 

  • The results will now be displayed in the “Suite Execution Result” details in Json format under the body tab. 

 

(5) GetAllSessionsOfProject

 

This API is used to fetch all the details of the execution result of all sessions from a project. This API takes a few Query Parameters and Authorization Token as input using GET Method. 

API URI Variable – https://xyz.smartopkey.com/api/OpkeyRestV2/GetAllBuilds?ProjectName=NameofProject

Resource Path (Static) /api/OpkeyRestV2/GetAllSessions

Query Parameter (Variable)?ProjectName=NameofProject

Note: Here the API URI and Query Parameter will be variable in nature which will depend on your Project Name

  • Select the “GET” method and enter the API URI, go to the “Params” tab, and enter the “Project Name”.

  • Go to the Authorization tab and enter the Authorization Token and then click on Send to run the Get Method and fetch execution result.
  • Here, you can have a look at the Test Case Execution Result details in Json format under the Body tab.

 

(6) GetAllTagsOfSession

This API is used to fetch the details about the execution result of all tags of a session. This API takes a few Query Parameters and Authorization Token as input using GET Method. 

API URI – https://xyz.smartopkey.com/api/OpkeyRestV2/GetSessionTags?ProjectName=NameofProject&BuildName=NameofBuild&SessionName=NameofSession

Resource Path (Static) /api/OpkeyRestV2/GetSessionTags

Query Parameter (Variable)?ProjectName=NameofProject&BuildName=NameofBuild&SessionName=NameofSession

Note: Here the API URI and Query Parameter will be variable in nature which will depend on your Project Name, Build Name, and Session Name

  • Select the “GET” method and enter the API URI, go to the “Params” tab, and enter the “Project Name”, “Build Name”, and “Session Name”. 

  • Go to the Authorization tab and enter the Authorization Token and then click on Send to run the “GET” Method and fetch the execution result.
  • Here, you can have a look at the Test Case Execution Result details in Json format under the Body tab.

 

METADATA APIs

(7) GetAllMetadataBuild

This API fetches the details about the Project’s MetadataBuild in Json format. This API takes few Query Parameters and Authorization Tokens as input using GET method.

If OpKey Web Domain URL is https://www.xyz.myopkey.com then

  • API URI (Variable): https:www.xyz.myopkey.com/api/OpKeyRestV2/GetAllMetaDataBuild?ProjectName=ABC
  • Resource Path (Static): /api/OpKeyRestV2/GetSuiteResult
  • Query Parameter (Variable) : ?

ProjectName=ABC

Note: Here, the API URI and Query Parameters are variable in nature which depend on your Project, Build, Session, etc.

  • Select the Get Method and enter the API URL, go to the Params tab and enter Query Parameters like Project Name
  • Go to the Authorization tab and enter the Authorization Token and then click on Send to run the Get Method and fetch execution result.
  • Here you can have a look at the Suite Execution Result details in Json format under the Body tab.

 

(8) GetAllMetadataSessionOfBuild

This API is used to fetch all MetaData Session of Build in Json format. This API takes a few query Query Parameters and Authorization Tokens as input using GET method.

 

(9) GetSessionMetadata

This API fetches the details about the execution result of MetaData Session in Json Format. This API is used to fetch all MetaData Session of Build in Json format. This API takes few query Query Parameters and Authorization Tokens as input using GET method.

 

 

Was this article helpful to you? Yes 1 No 1