1

I am trying to consume a publicly exposed URL and I need to pass auth headers to it. The format of the HTTP header is :

auth:{"Username": "p09jh789-f098-h6fv-b386-008cd88bd4fe","Password": "xxxxxxxx","authKey": "62b6380d-9e06-6age-cf09-134614b77d5e"}

I tried to set auth header for the REST API and I am not able to pass this JSON string since text headers throw up datatype issue. This happens even if I try to escape the JSON string. Please help me with doing it.

Poppy
  • 2,902
  • 14
  • 51
  • 75
  • 2
    You can customize the request by adding the 'OnBeforeRequest' action on the consumed API. Here you should be able to set the customised header values. – Hanno May 22 '17 at 13:53
  • But that doesn't allow me to set a header value to be a JSON object :( – Poppy May 23 '17 at 12:46
  • Not sure what you mean by *throw up the datatype issue*. HTTP Headers are always plain text. Any other format you want to send in a HTTP header needs to be converted to a plain text string beforehand. – Miguel Ventura May 23 '17 at 19:04
  • Can you perhaps share the URI of the API you are consuming so that we can help you test? – Hanno May 25 '17 at 16:08
  • [When right-clicking the consumer RESTful Api you can add the parameters here:](https://i.stack.imgur.com/nhiZF.png) – Roman Vinnick Apr 26 '20 at 17:20

1 Answers1

0

Send each value as a different header item. And validate each item in the OnBeforeRequest.