Joe C
Joe C

Reputation: 3993

Twilio Studio HTTP Post Request Header

I am trying to use the Http Request Widget, content type - application/json. I do not see an option to add a request header to supply a token. This .Net code gets a success response:

        string str = "Hello Webservice";
        string url = "https://website.com/webserviceurl.php";
        HttpClient httpClient = new HttpClient();

        httpClient.DefaultRequestHeaders.Add("token", "xxxx");
        HttpResponseMessage response = await httpClient.PostAsync(url, new StringContent(str));

In Twilio Studio I tried setting the content type to form url encoded so that I could add my token as a parameter but that didn't work. I got a 500 response.

Has anyone done this before? I have reached out to Twilio support but thought I might get lucky here. Thank you

Upvotes: 3

Views: 1114

Answers (1)

Joe C
Joe C

Reputation: 3993

It looks like I was not searching correctly as the answer is here:

twilio studio does not allow headers in http requests if the body is JSON

Upvotes: 3

Related Questions