Bug #6446
closed
our API is only JSON format??
Responded to your email but figured I'd post a copy here too. What do you mean by "our API is only JSON format"? Does that mean that users can't submit form data to the fortello API? Looks like you can to me:
$ curl -X POST http://localhost:3000/api/v2/organizations -d "organization[name]=Test2345" -u admin:changeme
{"ancestry":null,"apply_info_task_id":null,"created_at":"2014-07-17T12:22:48Z","default_info":{"system":[],"distributor":[]},"description":null,"id":7,"ignore_types":[],"katello_default":true,"label":"Test2345","name":"Test2345","owner_auto_attach_all_systems_task_id":null,"title":"Test2345","updated_at":"2014-07-17T12:22:55Z","service_levels":[],"service_level":null}
The problem that I've dealt with a few times over the past month with the API users is that they see that requests like this don't work:
$ curl -X POST http://localhost:3000/api/v2/organizations -d "name=Test2345" -u admin:changeme
While requests like this do:
$ curl -X POST http://localhost:3000/api/v2/organizations -d "organization[name]=Test2345" -u admin:changeme
So they get confused and then I get asked questions like "Why does the apidoc say that the params should be un-nested but then I get an error when I send nested params?" and "Why are some api endpoints nested and others aren't?" Maybe the solution is to show an error that we only accept JSON? I don't care either way but I feel like we do need to do something though because I've seen this at least 3 times already.
- Subject changed from Consider extending wrap_parameters since a lot of API users aren't using JSON to Since a lot of API users aren't using JSON to send requests, consider extending wrap_parameters or showing an error when they send other content types like application/x-www-form-urlencoded
- Subject changed from Since a lot of API users aren't using JSON to send requests, consider extending wrap_parameters or showing an error when they send other content types like application/x-www-form-urlencoded to We need to either support non-json requests or show an error when a user submits other content types.
- Related to Bug #6786: Cannot create an organization. added
- Status changed from New to Ready For Testing
- Target version set to 1.8.0
- Pull request https://github.com/theforeman/foreman/pull/1622 added
- Pull request deleted (
)
- Assignee set to David Davis
- Target version changed from 1.8.0 to 1.7.5
- Translation missing: en.field_release set to 10
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
- Bugzilla link set to 1129769
- Related to Bug #8846: Katello API throws an incorrect error when receiving non-json requests added
Also available in: Atom
PDF