Choose Language Hide Translation Bar
Highlighted
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
Highlighted
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

1 REPLY 1
Highlighted
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

Article Labels

    There are no labels assigned to this post.