Resources posted via api response id 0 [solved]


#1

Hey,

i am new to DreamFactory and i have a problem with the API. Testing out the API and posting new entries to a tables called hosts results in a 200 with a response that contains an id of 0.

We are using DreamFactory 2.8.1. The Server runs CentOS, MySQL 5.6, Apache.

Do you have any clue what could go wrong? All i read pointed out that the response should contain the IDs of the newly created entries.

Thanks for taking the time.
Stefan


#2

Solved. The example request body contains “id”: 0 what makes DreamFactory return the 0. I removed this and now everything works fine.


#3

@stefan1st typically if an id field is auto-incremented you can leave this field out of your JSON payload completely. DF will insert the records and return the id.