pyeve / eve-sqlalchemy

SQLAlchemy data layer for Eve-powered RESTful APIs
http://eve-sqlalchemy.readthedocs.io
Other
232 stars 70 forks source link

PATCH + update integer field #22

Closed ddurieux closed 9 years ago

ddurieux commented 9 years ago

When I try to update an integer field with curl + json data, I have errors.

See the 2 cases:

First case (with " for the integer value)

curl -H "If-Match: 93f85bf839f34164e062e8907baaf5352f72000a" -X PATCH -i http://127.0.0.1/hit/10 -d '{"hits": "44"}' -H 'Content-Type: application/json'

and the error: {"_status": "ERR", "_issues": {"hits": "must be of integer type"}}

second case (without " for the integer value)

curl -H "If-Match: 93f85bf839f34164e062e8907baaf5352f72000a" -X PATCH -i http://127.0.0.1/hit/10 -d '{"hits": 44}' -H 'Content-Type: application/json'

and the error: {"_error": {"message": "The browser (or proxy) sent a request that this server could not understand.", "code": 400}, "_status": "ERR"}

Perhaps check if the value is a number and convert it into integer, but perhaps there is a better method ;)