Test Data Manager

 View Only

AgileDesignerAutomator 202 - REST Call to TDM 

Nov 15, 2017 04:32 AM

Introduction

This document is a small guide on how to use the REST Post activity in Javelin/Ada to call the TDM API.

 

In order to be able to use the TDM API a token must be requested. Once the token has been received it will be re-used in the create group call or in any other TDM API call. 

 

The workflow consist of the following elements:

- Process to Generate token call

- Process to Create group call

 

 

A couple of variables are used to store the responses, headers and token. For readability variable names are shown in Italic.

 

In the following sections, each of the calls will be explained in more detail.

 

Generate Token

As shown below, the generate token call is the first step in the process. Second step is to assign the response to the token variable and last step is to log our generated token

For the Generate Token POST call the following properties are needed:

  • BaseURL: baseurl
  • DisplayName: Generate Token POST call
  • IsBasicAuthentication: True
  • IsJSON: True
  • Password: <password>
  • RequestContent: ""
  • RequestType: "POST"
  • Resource: "TestDataManager/user/login"
  • RestResponseJObject: tokengenresponse
  • Username: "administrator"

 

In the variable assignment step, the generated token is extracted from the response.

  • DisplayName: Fetch Token
  • To: token
  • Value: tokengenresponse.GetValue("token").ToString()

 

Logging step

  • DisplayName: Log Token
  • MessageToLog: token

 

Create Group Call

In this process sequence, a couple of new variables have been defined and their scope is limited to the process only. The variables are used to assemble the content body for the add group request and to store the response of the call.

The used project id value of addGroupContent does need to be altered to reflect your environment.

 

First the header needs to be constructed, which is done in 2 steps.

step 1:

  • DisplayName: InvokeMetho
  • TargetObject: headers
  • TargetType: null
  • Parameters:
    • Direction: In
      • d
      • MethodeName: Add
    • Type: String
    • Value: "Authorization"

step 2:

  • DisplayName: InvokeMethod
  • MethodeName: Add
  • TargetObject: headers
  • TargetType: null
  • Parameters:
    • Direction: In
    • Type: String
    • Value: "Bearer " & token

Next the content object needs to be constructed, which is again done in 2 steps.

step 3:

  • DisplayName: InvokeMethod
  • MethodeName: Add
  • TargetObject: QueryString
  • TargetType: null
  • Parameters:
    • Direction: In
    • Type: String
    • Value: "projectId"

step 4

  • DisplayName: InvokeMethod
  • MethodeName: Add
  • TargetObject: QueryString
  • TargetType: null
  • Parameters:
    • Direction: In
    • Type: String
    • Value: "2500" (See finding out the project ID document)

Step 5:

As last step another REST Post activity is executed.

  • BaseURL: baseurl
  • DisplayName: Add Group
  • IsBasicAuthentication: False
  • IsJSON: True
  • Password: <password>
  • QueryString: QueryString
  • RequestContent: addGroupContent
  • RequestType: "POST"
  • Resource: "TestDataManager/api/ca/v1/groups"
  • RestResponseJObject:addGroupResponse

 

When the flow is executed the following log output is produced.

Running flow...
2017-11-16 09:57:29 - Run flow: C:\Users\dezpe01\Desktop\post_call_add_group.vwf
2017-11-16 09:57:29 - Running Test Case: Flowchart
2017-11-16 09:57:29 - Executing Step: Generate Token POST call
2017-11-16 09:57:30 - Executing Step: Log Token
2017-11-16 09:57:30 - eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJBZG1pbmlzdHJhdG9yIiwiYXVkIjoiQUxMIiwiUFdEX0hBU0hfQ0xBSU0iOiI4MzkzMTQyODMiLCJpc3MiOiJDQSBUZWNobm9sb2dpZXMiLCJVU0VSX0lEIjoiMSIsImV4cCI6MTUxMDkwOTA1MCwiaWF0IjoxNTEwODIyNjUwLCJBQ0NFU1NfUEVSTUlTU0lPTlMiOiJ7XCJBTExfUFJPSkVDVFNcIjpbMTAwXX0ifQ.hHRxIaoQfYZq7eLOs0NFNKL2ceD_scNIkGS9rr-doVo
2017-11-16 09:57:30 - Executing Step: Add group
2017-11-16 09:57:32 - Running Test Case: Flowchart
2017-11-16 09:57:32 - Test Case: Flowchart Execution Complete
Execution complete

 

Verification in TDM portal shows that the user group was created.

 

Statistics
0 Favorited
23 Views
1 Files
0 Shares
5 Downloads
Attachment(s)
zip file
post_call_add_group.vwf.zip   2 KB   1 version
Uploaded - May 29, 2019

Related Entries and Links

No Related Resource entered.