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

  • Our picks

    • How to 3D print with reinforced engineering materials
      Ultimaker is hosting a webinar where we explain how you can achieve and maintain a high print success rate using these new reinforced engineering materials. Learn from Ultimaker's Product Manager of Materials and top chemical engineer Bart van As how you can take your 3D printing to that next level.
      • 0 replies
    • "Back To The Future" using Generative Design & Investment Casting
      Designing for light-weight parts is becoming more important, and I’m a firm believer in the need to produce lighter weight, less over-engineered parts for the future. This is for sustainability reasons because we need to be using less raw materials and, in things like transportation, it impacts the energy usage of the product during it’s service life.
        • Like
      • 12 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!