POST to table with only one auto-increment column


#1

Hi everyone,

I am using a table with only one record, named “id”, containing an auto-incremented value.
If I POST to the table with this body:

{
  "resource": [
    {
      "id":0
    }
  ]
}

then a new record gets created with an auto-incremented value but the response doesn’t tell the value.
It shows 0 for the id. Is it normal?

It actulally also happens if I POST to a table having more columns. If I write “id”:0 then the reponse also shows “id”:0.

{
  "resource": [
    {
      "id":0,
      "date":"2017-08-08"
    }
  ]
}

It doesn’t happen, if I POST to this other table leaving out the id, e.g.:

{
  "resource": [
    {
      "date":"2017-08-08"
    }
  ]
}

Then the real id of the newly created record comes in the response.

Is there a known work around, so that I can POST to the single auto-incremented column and know its created id?

Thanks in advance