Code Monkey home page Code Monkey logo

Comments (3)

arurke avatar arurke commented on August 11, 2024

Hijacking this to post a valid curl call which might be handy to post as an example:
curl -i -H "Content-type: application/json" -X POST -d '{"sensorid":"sensor_id","timestamp":"2015-11-10T22:32:00Z","value":11,"key":"d6ba65e8-4aa7-4bd8-90bc-df939aaaae99"}' http://friskby.herokuapp.com/sensor/api/reading/

from friskby.

joakim-hove avatar joakim-hove commented on August 11, 2024

Ehh - yes I agree this is slightly confusing; but both work. The actual comparison is done here: https://github.com/FriskByBergen/friskby/blob/master/api_key/models.py#L14 - and the UUID( ) constructor will strip of the dashes internally.

from friskby.

arurke avatar arurke commented on August 11, 2024

Are you sure? I re-tested and get "invalid key" when omitting dashes.

curl -i -H "Content-type: application/json" -X POST -d '{"sensorid":"ARUtest","timestamp":"2015-11-10T22:32:00Z","value":11,"key":"d6b065e842a74bd890bcdf939d91de99"}' http://friskby.herokuapp.com/sensor/api/reading/

HTTP/1.1 403 FORBIDDEN
"Invalid key:'d6b065e842a74bd890bcdf939d91de99' when posting to:'ARUtest'"

curl -i -H "Content-type: application/json" -X POST -d '{"sensorid":"ARUtest","timestamp":"2015-11-10T22:32:00Z","value":11,"key":"d6b065e8-42a7-4bd8-90bc-df939d91de99"}' http://friskby.herokuapp.com/sensor/api/reading/

HTTP/1.1 201 CREATED

I see now that the page I linked to is actually intended for editing so its probably a bad idea to get the key from there anyway. But maybe update the example on the main page with a dummy key with dashes, or allow keys with and without dashes?

from friskby.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.