You are not logged in.
Pages: 1
Hello,
I have another problem and hope that someone can give me a clue.
I send a new record to the REST server from the browser via Ext.Ajax.request. The dataset is created and I get a response message that the dataset is being created. The response also contains the data I sent. What I miss is the record ID that was assigned when the record was created.
I hope I was able to explain the problem reasonably by then!?
How do I get the REST server to send me the ID of the created record back without having to set an interface function?
I would like to thank you in advance
Olaf
Offline
Check the headers in the HTTP response, the new record ID is there.
Esteban
Offline
Hello Esteban,
unfortunately not.
Chrome time the following:
General:
Request URL:http://b6996c001.4all-media.root:8990/V1/MAS/Title/
Request Method:POST
Status Code:201 Created
Remote Address:169.254.63.187:8990
Referrer Policy:no-referrer-when-downgrade
Response Header
HTTP/1.1 201 Created
Location: Title/23
Server: mORMot (Windows) Microsoft-HTTPAPI/2.0
X-Powered-By: mORMot 1.18 synopse.info
Server-InternalState: 28
Access-Control-Allow-Methods: POST, PUT, GET, DELETE, LOCK, OPTIONS
Access-Control-Max-Age: 1728000
Access-Control-Expose-Headers: content-length,location,server-internalstate
Access-Control-Allow-Origin: *
Accept-Encoding: synlz,gzip
Date: Fri, 17 Nov 2017 15:55:18 GMT
Content-Length: 0
Requerst Header
POST /V1/MAS/Title/ HTTP/1.1
Host: b6996c001.4all-media.root:8990
Connection: keep-alive
Content-Length: 33
Pragma: no-cache
Cache-Control: no-cache
Origin: http://b6996c001.4all-media.root:1841
X-Requested-With: XMLHttpRequest
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36
Content-Type: application/json
Accept: */*
DNT: 1
Referer: http://b6996c001.4all-media.root:1841/?locale=de/
Accept-Encoding: gzip, deflate
Accept-Language: de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7
Request Payload
{"Name":"Test 3","Active":"true"}
I don't understand. The search continues...; -)
But despite everything, thank you very much!
Olaf
Offline
In "Location: Title/23" it's the answer: "23" is the new ID in table "Title".
Esteban
Offline
Hello, me again,
I found it. The following parameter must be set.
Great and thank you very much
Olaf
DB.Options := [rsoAddUpdateReturnsContent];
Offline
Pages: 1