Passing parameter to header fails

Hi, I’m trying to make a custom app for Walmart Marketplace following the guide and example given to me by a helpful Maker. There is an API call that requires multiple values in the “Accept” header and I want the second value to be mappable to a user selection. When I do this, it appears the selection is sent in the body rather than the header. My configurations:

Communication:

{
    // Request to API endpoint.
    "url": "/v3/shipping/labels/carriers/{{parameters.carrierShortName}}/trackings/{{parameters.trackingNo}}", // Relative to base URL
    "method": "GET",
    "headers": {
        "Content-Type": "application/x-www-form-urlencoded",
        "Accept": "application/json,{{parameters.mediaType}}"
    }, // Additional HTTP headers

    "qs": {
    },

    "response": {
        "output": "{{body}}"
    }
}

Mappable Parameters

[
	{
		"name": "mediaType",
		"type": "select",
		"options": [
			{
				"label": "PDF",
				"value": "application/pdf"
			},
			{
				"label": "PNG",
				"value": "image/png"
			}
		],
		"multiple": false,
		"required": true
	},
	{
		"name": "carrierShortName",
		"type": "text",
		"required": true,
		"label": "Carrier short name"
	},
	{
		"name": "trackingNo",
		"type": "text",
		"required": true,
		"label": "Tracking number"
	}
]

The “Accept” header should be either “application/json,application/pdf” or “application/json,image/png”.

What am I doing wrong?

Hi @skanfklwef

Not sure why the selection would appear in the body.

In the "Accept": "application/json,{{parameters.mediaType}}", is the comma used as separator? if so, this breaks the JSON. You can try to do it like this:

"Accept": "application/json+','+{{parameters.mediaType}}"

Otherwise, have a look at this rule for inheritence: Advanced inheritance | Make Apps

Cheers,
Henk

1 Like