How to set a var in a x-www-form-urlencoded request body?

I need to set variables in below request body.
image

and i tried the x-www-form-urlencoded like below, it is poping up ‘unsupported media type’.
image

Hey @wangjing0125 :wave:

Welcome to the Postman Community! :postman:

Without knowing what that API expects as a payload type (Raw JSON, Form-Data, Etc) it difficult to give you a working solution. Could you share any documentation you might be following?

One method you could use to add variables into a request body is to create the structure and data in a pre-request script, save that as a variable and then reference this in your payload body.

If you’re able to expand on the details of the request, we’ll be able to help you further.

Considering your first screenshots and that some elements are objects within object, I suspect this is raw\JSON.

Have you done through the Postman docs yet?

Using variables | Postman Learning Center

As this is fairly straight forward. Store you values as collection or environment variables and then reference them in the body using double curly brackets. {{variableName}}.

If you are new to Postman, then I would suggest a visit to the Learning Centre.

Overview | Postman Learning Center

Including the Postman Training links under “Other Resources”.

image

I would recommend the “Galaxy APIs 101” course first as it gets you used to the application features and the GUI.

Then the “Galaxy Testing and Automation” course which teaches you how to assert the responses. It includes defining and using variables from responses.


in this body the taskid and pocessinstanceid will be passed from last API, variables will be fixed value but with array in it. I tried below and still got a 415.

Pretty sure the body for your request should be raw\JSON, not x-www-form-urlencoded.

how should I do parameterization in a raw/JSON ? the other 2 parameters needs to be dynamic

set global variable and apply it as below, the issue get resolved. thanks