This is a migrated thread and some comments may be shown as answers.

cURL request gets a red 502

4 Answers 295 Views
Fiddler Classic
This is a migrated thread and some comments may be shown as answers.
James
Top achievements
Rank 1
James asked on 20 Jun 2017, 01:01 PM
New to fiddler. I am trying to do a REST API curl request but getting a red 502 response.

Here is the curl request:

curl -X GET https://sandbox.forte.net/api/v3/organizations/org_333251/locations/loc_191620/customers/
-H "Content-Type: application/json"
-H "X-Forte-Auth-Organization-Id: org_333251" 
-H "Authorization: Basic Mjk3NjMwMGJiNjlmMDhiMmRmZTU3NzU0ZDkyMWI4Y2Q6NmU4N2QwZjUwMmE4ZGE5M"
-H "Accept: application/json"
-H "Cache-Control: no-cache"

It is a sandbox account so no problem if you want to play around with it.

All the credentials are good, and it works in Postman and it works in a Windows command prompt.

But for the life of me I can't get it to work in Fiddler :(

What am I missing?

4 Answers, 1 is accepted

Sort by
0
James
Top achievements
Rank 1
answered on 20 Jun 2017, 01:06 PM

The authorization window says no authorization header is being sent, and when I look at headers sure enough, no auth headers.

So it seems I'm just missing the correct syntax, but I have tried it a million ways from Sunday and can't make it work :((

0
James
Top achievements
Rank 1
answered on 20 Jun 2017, 02:01 PM

I found this stackoverflow ticket where he is posting curl in fiddler:

https://stackoverflow.com/questions/25104371/php-curl-adds-0-nul-character-to-method-error-501-method-post-is-not-define

So I set my curl request like his, and now I'm getting a red 400, but it appears it is not sending the authorization headers still.

See attached screenshots of Fiddler.

My modified curl request:

curl: 
-k: 
-i: 
--raw: 
-o 0.dat: 
-X GET: 
"https: //sandbox.forte.net/api/v3/organizations/org_333251/locations/loc_191620/customers"
-H "X-Forte-Auth-Organization-Id: org_333251"
-H "Authorization: Basic Mjk3NjMwMGJiNjlmMDhiMmRmZTU3NzU0ZDkyMWI4Y2Q6NmU4N2QwZjUwMmE4ZGE5MTBmZWMxY2FmZjkxYjdjYjU="
-H "Content-Language: en-US"
-H "Content-Type: application/json"
-H "Cache-Control: no-cache"
-H "Accept: application/json"
-H "Connection: keep-alive"

0
James
Top achievements
Rank 1
answered on 20 Jun 2017, 03:11 PM

I ran a php file from xampp/Chrome on the same endpoint, then in fiddler did a File > Export session and got this interesting curl code:

curl -k -i --raw -o 0.dat "http://localhost/REST-example.v3.php" -H "Host: localhost" -H "Connection: keep-alive" -H "Upgrade-Insecure-Requests: 1" -H "User-Agent: Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.104 Safari/537.36" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8" -H "Accept-Encoding: gzip, deflate, br" -H "Accept-Language: en-US,en;q=0.8" -H "Cookie: __utma=111872281.153567928.1471552479.1472044685.1472061723.4"|

So I set up my curl request in a similar fashion:

curl: 
-k: 
-i: 
--raw: 
-o 0.dat: 
-X GET: 
"https: //sandbox.forte.net/api/v3/organizations/org_333251/locations/loc_191620/customers": 
-H "X-Forte-Auth-Organization-Id: org_333251"
-H "Authorization: Basic Mjk3NjMwMGJiNjlmMDhiMmRmZTU3NzU0ZDkyMWI4Y2Q6NmU4N2QwZjUwMmE4ZGE5MTBmZWMxY2FmZjkxYjdjYjU="
-H "Connection: keep-alive"
-H "Upgrade-Insecure-Requests: 1"
-H "User-Agent: Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.104 Safari/537.36"
-H "Accept: text/html,application/json,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8"
-H "Accept-Encoding: gzip, deflate, br"
-H "Accept-Language: en-US,en;q=0.8"
-H "Cookie: __utma=111872281.153567928.1471552479.1472044685.1472061723.4"
Host: sandbox.forte.net

No joy. Still getting a red 400.

0
Steve
Top achievements
Rank 1
answered on 07 Nov 2017, 09:43 AM
Blahhhhh
Tags
Fiddler Classic
Asked by
James
Top achievements
Rank 1
Answers by
James
Top achievements
Rank 1
Steve
Top achievements
Rank 1
Share this question
or