cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Submit your abstract to the call for content for Discovery Summit Americas by April 23. Selected abstracts will be presented at Discovery Summit, Oct. 21- 24.
Discovery is online this week, April 16 and 18. Join us for these exciting interactive sessions.
Choose Language Hide Translation Bar
luizpdlh
Level I

HTTP Request wtih Headers on JMP 15

Hello,

 

I'm trying to make an HTTP request to an API but I need to pass on two headers, a username and a token, however after several different tries I'm not able to pass more than one header. If I pass only the username, it reaches the API, however when I pass both it doesn't parse them correctly (I'm able to connect from diffent sources, such as through a Python script).

 

Here's the attempt I believe makes the most sense:

 

myAPIURL = "https://my.api.url/";

myRequest = New HTTP Request(
	URL(myAPIURL),
	Method("GET"),
	Headers("username: XXX213098457, token: 098ASHDK23UE2D903YG");
);

If I do the call only with the username, I'm able to reach and have it parsed on the API, however when I add the token, it doesn't even parse the username. Could that be a bug, or is there any other documentation on how to use headers? I've searched the community but didn't see much, specially on JMP 15.

 

e.g., this works:

myAPIURL = "https://my.api.url/";

myRequest = New HTTP Request(
	URL(myAPIURL),
	Method("GET"),
	Headers("username: XXX213098457");
);
1 ACCEPTED SOLUTION

Accepted Solutions
Ryan_Gilmore
Community Manager Community Manager

Re: HTTP Request wtih Headers on JMP 15

Try the following:

 

request_headers = Associative Array();
request_headers["username"] = "XXX213098457";
request_headers["token"] = "098ASHDK23UE2D903YG";

myRequest = HTTP Request( Url( myAPIURL ), Method( "GET" ), Headers( request_headers ) );

View solution in original post

2 REPLIES 2
Ryan_Gilmore
Community Manager Community Manager

Re: HTTP Request wtih Headers on JMP 15

Try the following:

 

request_headers = Associative Array();
request_headers["username"] = "XXX213098457";
request_headers["token"] = "098ASHDK23UE2D903YG";

myRequest = HTTP Request( Url( myAPIURL ), Method( "GET" ), Headers( request_headers ) );
UersK
Level III

Re: HTTP Request wtih Headers on JMP 15

Thanks!