Where to add _postman_previewlanguage to example response

Hi,

off the back of this thread → Mock collection item update (delta update)

I am working through the examples @aerospace-geoscient2 kindly provided, which seems to be working well for what I require.

I have a follow up question which I could not ask in time as I was on a leave.

How can I add the _postman_previewlangugage when I am creating my example response? To what object this value belongs?

Thank you

Hey @supply-technologist8 :wave:

I’m not 100% sure on this and @aerospace-geoscient2 would be able to give you a clearly answer but going of this request, which creates a POST example using JSON:

https://www.postman.com/postman/workspace/postman-public-workspace/example/12959542-6881e500-d7fe-44a1-b413-d962a9cc8b3d

The dataOptions object might be the place that handles this:

{
    "name": "Example POST Response",
    "description": "This is an example POST response.",
    "url": "https://postman-echo.com/post",
    "method": "POST",
    "headers": [
        {
            "key": "Host",
            "value": "postman-echo.com"
        },
        {
            "key": "user-agent",
            "value": "curl/7.88.1"
        },
        {
            "key": "accept",
            "value": "*/*"
        },
        {
            "key": "content-type",
            "value": "application/json"
        },
        {
            "key": "content-length",
            "value": "22"
        }
    ],
    "dataMode": "raw",
    "rawModeData": "{\n  \"field\": \"Value\"\n}",
    "dataOptions": {
        "raw": {
            "language": "json"
        }
    }
}

@danny-dainton thanks!

Will give it a try and will let you know.

Ty,
C

I tried it but the json remained untouched.

Would you know what other properties the dataOptions object has?

I think the above is working as JSON is selected as body language, I need it prettified which should be an object within

Ah, that’s a shame. :cry:

I’m going to need to refer to @aerospace-geoscient2 for that question, I’m not sure of the schema for that API.

Given the time and his location, I’m not sure that you’re going to get an immediate answer today. Hopefully, he’ll get back to you as soon as he can :pray:

No rush! Thank you for your help and have a good weekend!

Ok I am taking that back. It appears as json language is selected but formatting not applied which I believe was handled by the _postman_previewlanguage

Sorry for the spam, I found the driver of this which is the - language property, however the json response only gets formatted if i click on json again in postman

Hi!
Are you sending the rawModeData including newline characters and spacing?
For instance:

"rawModeData": "{\n  \"field\": \"Value\"\n}",

Using \n you could format the example body properly. The previous code should be rendered as

{
    "field": "value"
}

Hi David @aerospace-geoscient2,

I will try that, for some reason I don’t have success with the rawData object, I am getting the example response body by using the text property, is this the wrong way?

With regards to _postman_previewlanguage is it at all available?

Hello again,

What does - Parent field is missing for the given model - error means?

Sending to /requests the same body as I do with the postman client but getting the above error

This topic was automatically closed 45 days after the last reply. New replies are no longer allowed.