ALERT: Some images may not load properly within the Knowledge Base Article. If you see a broken image, please right-click and select 'Open image in a new tab'. We apologize for this inconvenience.

Equivalent DevTest REST step for a CURL POST request with --data-urlencode

book

Article ID: 226953

calendar_today

Updated On:

Products

Service Virtualization

Issue/Introduction

What is the equivalent DevTest REST step for the following CURL POST request that uses --data-urlencode:


curl --location --request POST 'https://localhost/oauth20/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'client_id=qwerty' \
--data-urlencode 'client_secret=123456' \
--data-urlencode 'grant_type=client_credentials' \
--data-urlencode 'scope=security:system'

Environment

Release : 10.6

Component : DevTest Workstation

Resolution

The equivalent REST step can be configured as follows.
URL tab:
curl --location --request POST 'https://<hostname>/isam/sps/oauth/oauth20/token'

Headers tab:
--header 'Content-Type: application/x-www-form-urlencoded' 

Content tab:
--data-urlencode 'client_id={{$x_api_key}}' \
--data-urlencode 'client_secret={{$x_api_secret}}' \
--data-urlencode 'grant_type=client_credentials' \
--data-urlencode 'scope=security:system'

Another option is to run the Curl request from an execute external command step.

Attachments