Jump to content
Ultimaker Community of 3D Printing Experts
hlinden

Acessing the API fails with curl - what am I doing wrong?

Recommended Posts

When I access /api/v1/auth/verify using Firefox, that works fine.

When I create a curl request from that using the Firefox debugger that works fine:

 

[me@machine]$ curl "http://xxx.xxx.xxx.xxx/api/v1/auth/verify" -H "Host: xxx.xxx.xxx.xxx" -H "User-Agent: Mozilla/5.0 (Windows NT 10.) Gecko/20100101 Firefox/45.0" -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" -H "Accept-Language: de,en-US;q=0.7,en;q=0.3" --compressed -H "Authorization: Digest username=""6384f43f0e8aef0e024949b01fe67ba3"", realm=""Jedi-API"", nonce=""dcf0ed0acc248b6918bd25bef863996f"", uri=""/api/v1/auth/verify"", response=""e39ef5c9445ee93a237244dbf2e50aa8"", qop=auth, nc=00000007, cnonce=""87d281d69398db60""" -H "Connection: keep-alive" -H "Cache-Control: max-age=0"{"message": "ok"}

 

When I try to use curl with the same credentials and basic auth it fails:

 

[me@machine ~]$ curl -vv -u 6384f43f0e8aef0e024949b01fe67ba3:6453bdd1aa2ad0c8f2fcb8c8ef2fe7b9b550c654abbbbe54d3455bccc2bee83f http://xxx.xxx.xxx.xxx/api/v1/auth/verify*   Trying xxx.xxx.xxx.xxx...* TCP_NODELAY set* Connected to xxx.xxx.xxx.xxx (xxx.xxx.xxx.xxx) port 80 (#0)* Server auth using Basic with user '6384f43f0e8aef0e024949b01fe67ba3'> GET /api/v1/auth/verify HTTP/1.1> Host: xxx.xxx.xxx.xxx> Authorization: Basic NjM4NGY0M2YwZThhZWYwZTAyNDk0OWIwMWZlNjdiYTM6NjQ1M2JkZDFhYTJhZDBjOGYyZmNiOGM4ZWYyZmU3YjliNTUwYzY1NGFiYmJiZTU0ZDM0NTViY2NjMmJlZTgzZg==> User-Agent: curl/7.51.0> Accept: */*>* HTTP 1.0, assume close after body< HTTP/1.0 401 UNAUTHORIZED< Content-Type: application/json< Content-Length: 38< Cache-Control: no-cache, no-store, must-revalidate< Pragma: no-cache< Expires: 0< WWW-Authenticate: Digest qop=auth, realm="Jedi-API", nonce="27495c91bef5eaf2c338c2dda9d95a5c"< Server: Werkzeug/0.9.6 Python/3.4.2< Date: Tue, 21 Mar 2017 12:51:59 GMT<* Curl_http_done: called premature == 0* Closing connection 0{"message": "Authorization required."}

 

What am I doing wrong here?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Announcements

  • Our picks

    • Architect Contest | Entourage 01.
      Presenting an idea, an architectural design or something as big as an urban project isn't easy. A scaled models can really help to get your idea across. But besides your main model, there is more needed to get your idea across vividly! An architect regularly uses various entourage sets to help bring these ideas and models to live. 
        • Like
      • 9 replies
    • What The DfAM?
      I'm Steve Cox, an experienced engineer familiar with 3D printing. I wanted to share some DfAM guidelines with this community to help and make stronger parts.
      I'm also an Autodesk Certified Instructor for Fusion 360, so many of the images in ...
        • Thanks
        • Like
      • 17 replies
×

Important Information

Welcome to the Ultimaker Community of 3D printing experts. Visit the following links to read more about our Terms of Use or our Privacy Policy. Thank you!