cURL request gets a red 502

5 posts, 0 answers
  1. James
    James avatar
    6 posts
    Member since:
    Jun 2017

    Posted 20 Jun 2017 Link to this post

    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?
  2. James
    James avatar
    6 posts
    Member since:
    Jun 2017

    Posted 20 Jun 2017 Link to this post

    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 :((

  3. James
    James avatar
    6 posts
    Member since:
    Jun 2017

    Posted 20 Jun 2017 Link to this post

    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"

  4. James
    James avatar
    6 posts
    Member since:
    Jun 2017

    Posted 20 Jun 2017 Link to this post

    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.

  5. Steve
    Steve avatar
    1 posts
    Member since:
    Nov 2017

    Posted 07 Nov 2017 in reply to James Link to this post

    Blahhhhh
Back to Top