[AC-4717] create objects rest api call fails
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | n/a |
| Status | Closed |
| Resolution | Invalid |
| Resolution Date | 2017-01-11T16:25:00.000+0000 |
| Affected Version/s | Appcelerator Studio 4.5.0 |
| Fix Version/s | n/a |
| Components | ArrowDB |
| Labels | n/a |
| Reporter | heedoo moon |
| Assignee | Shak Hossain |
| Created | 2017-01-07T18:22:13.000+0000 |
| Updated | 2017-01-11T16:25:00.000+0000 |
Description
I sent below data for creating custom object but it returned "Missing FIelds" error callback.
Method : "POST"
URL : https://api.cloud.appcelerator.com/v1/objects/announcement/create.json?&key=MY_KEY&_session_id=MY_SESSION_ID&pretty_json=true
Params : {"fields": {"title":"aa","description":"bb"}}
I followed rest api syntax from this link "http://docs.appcelerator.com/arrowdb/latest/#!/api/CustomObjects-method-create"
Hello, Can you share the full curl command you are running for creating objects. The usual command is like
Also, send the error log. Thanks.$ curl -b cookies.txt -c cookies.txt -F "fields={\"color\":\"blue\", \"make\": \"nissan\", \"purchased_at\" : \"2011-11-02 17:07:37 -0700\", \"year\" : 2005, \"used\" : false, \"coordinates\":[-122.1, 37.1]}" https://api.cloud.appcelerator.com/v1/objects/car/create.json?key=<YOUR APP APP KEY>&pretty_json=trueHi Sharif, I tested with Postman not curl command and this is error log. { "meta": { "status": "fail", "code": 400, "message": "Missing fields", "method_name": "createObject" } } Are you able to get data?
Never mind. I found that arrowdb rest api requires to pass all data as in url instead of body. example) method : POST url : https://api.cloud.appcelerator.com/v1/objects/announcement/create.json?&key=MY_KEY&_session_id=MY_SESSION_ID&fields='{"title\":"aa","description":"bb"}'&pretty_json=true