Closed waynew closed 8 years ago
I think you just forgot to set the POST's Content-Type. Try this:
⚘ curl -X POST http://localdocker:8080/people -d '{"lastname": "Dude"}' -H 'Content-Type: application/json'
This also explains the error message: It is not complaining about 'lastname' being unknow, but '{\"lastname\": \"Dude\"}' - which is your entire payload.
Ah, right, doh!
So now I guess it validates, but:
TypeError: '_updated' is an invalid keyword argument for People
I guess that's because Eve is trying to provide (require?) metadata... that I don't want. Is there any way around that?
You're right. Fields like _updated, _created and _etag are automatically handled by Eve. You can change the name, though.
LAST_UPDATED: Name of the field used to record a document’s last update date. This field is automatically handled by Eve. Defaults to _updated. - http://python-eve.org/config.html
Unfortunately, I don't know any way to solve your issue in a clean way. Even if you could modify your models in a way so _updated does not get stored in your db, you might run into problems as Eve supports things like the If-Modified-Since header to query items based on the modification date.
Yeah, I don't think there's a way to get around that, unless eve-sqlalchemy wanted to patch. I think I'll go ask about that on the Eve issue tracker
I have this code and I've got
0.3.4
installed:But when I try to post some data:
Um... Excuse me? Unknown field?
lastname
is not an unknown field.Though I wonder about it now... I just changed my validator to this guy:
And when I run that it barfs and triggers the debugger which shows me
TypeError: '_etag' is an invalid keyword argument for People
. Is it just that eve is trying to inject fields? Or what? I've been at this for entirely too long and I think I might be going crazy :P