2

I am Insert Data in Sharepoint list using REST API.

Its inserted Successfully but I want in Response that inserted Record ID.

Is there any way to get it.?

I don't want to call request again.

Any Help greatly Appreciated.

  • You could do a Caml-Query with rowlimit 1 and sort by id descending. The result is the last created element. – Mx. Jul 29 '16 at 13:37
3

Whenever you are creating Item using REST API it will give you a JSON response in returned. If you parse your JSON using JSON Parser you can see all the details regarding created item is visible. So you can parse JSON response and get whatever you want. See attached snap.

enter image description here

  • Dear when i am call POST request using REST Its not return any json. Is there any header for it i have to set? – Vishal Thakkar Jul 30 '16 at 4:19
  • I tried this practically and then posted the snap. Still I will be checking once again for your query. – Aakash Maurya Jul 30 '16 at 4:36
  • actually i am fire Request from Mobile application. – Vishal Thakkar Jul 30 '16 at 4:37
  • Ok. I can't verify that, I can only verify with Client Machine and I am getting it. Because I am not having mobile development environment – Aakash Maurya Jul 30 '16 at 4:43
  • can you give me which header you pass in post request? – Vishal Thakkar Jul 30 '16 at 4:45
2

Yes It returns a ID and also Id in the response. You can access like

yourResponse.d.ID
// OR
yourResponse.d.Id

yourResponse.d is the item you have just inserted.

ID and Id both are the same thing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.