Hi All,
I have been trying to get the datasource to refresh or update itself with the contents of a PUT response it sends to an odata service. I know normally the PUT would return 204 with updating a record, but I am returning a 200 with the contents that where updated. The main reason for this is that a timestamp (ETAG) value is updated and returned in the response. So the next time an edit is done on it should work, but currently it does not.
I have checked fiddler request/responses they are correct, it just that data source is not being refreshed with the contents being sent in the response.
Do I have to do a force refresh on the datasource and retrieve that page of data or is there another way?
The timestamp field is nested in the json response so I don't know if that is the cause or not.
Here is an example of the request
PUT https://localhost:444/admin/v2/accounts(6) HTTP/1.1
Host: localhost:444
Connection: keep-alive
Content-Length: 325
Cache-Control: max-age=0
Accept: application/json, text/javascript, */*; q=0.01
Origin: https://localhost:444
X-Requested-With: XMLHttpRequest
If-Match: "AAAAAAAADJ0="
User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.72 Safari/537.36
Content-Type: application/json
Referer: https://localhost:444/
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-GB,en-US;q=0.8,en;q=0.6
{"Id":"6","Name":"Test Account 5","Registered":null,"WebsiteUrl":"Testing","IsEnabled":true,"AccountType":"Retailer","Tracking":{"CreatedBy":"JhH1TV-f-P8cZgV19W0bhyI3UBLlHdbh79ZkzhnJSKA","CreatedOn":"2013-07-26T14:08:22.787","ModifiedBy":"JhH1TV-f-P8cZgV19W0bhyI3UBLlHdbh79ZkzhnJSKA","ModifiedOn":"2013-07-26T16:54:20.57","Timestamp":"AAAAAAAADJ0="}}
Here is an example of the response.
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-Type: application/json; charset=utf-8
Expires: -1
ETag: "AAAAAAAADJ4="
Access-Control-Allow-Origin: *
DataServiceVersion: 3.0
Date: Fri, 26 Jul 2013 17:05:14 GMT
Content-Length: 425
{
"odata.metadata":"https://localhost:446/admin/v2/%24metadata#accounts/@Element","Id":6,"Name":"Test Account 5","Registered":null,"WebsiteUrl":"Testing","IsEnabled":true,"AccountType":"Retailer","Tracking":{
"CreatedBy":"JhH1TV-f-P8cZgV19W0bhyI3UBLlHdbh79ZkzhnJSKA","CreatedOn":"2013-07-26T14:08:22.787","ModifiedBy":"JhH1TV-f-P8cZgV19W0bhyI3UBLlHdbh79ZkzhnJSKA","ModifiedOn":"2013-07-26T17:05:13.9989111Z","Timestamp":"AAAAAAAADJ4="
}
}
As you can see the ETag/Timestamp have been updated.
Any suggestions
Regards
Richard....
I have been trying to get the datasource to refresh or update itself with the contents of a PUT response it sends to an odata service. I know normally the PUT would return 204 with updating a record, but I am returning a 200 with the contents that where updated. The main reason for this is that a timestamp (ETAG) value is updated and returned in the response. So the next time an edit is done on it should work, but currently it does not.
I have checked fiddler request/responses they are correct, it just that data source is not being refreshed with the contents being sent in the response.
Do I have to do a force refresh on the datasource and retrieve that page of data or is there another way?
The timestamp field is nested in the json response so I don't know if that is the cause or not.
Here is an example of the request
PUT https://localhost:444/admin/v2/accounts(6) HTTP/1.1
Host: localhost:444
Connection: keep-alive
Content-Length: 325
Cache-Control: max-age=0
Accept: application/json, text/javascript, */*; q=0.01
Origin: https://localhost:444
X-Requested-With: XMLHttpRequest
If-Match: "AAAAAAAADJ0="
User-Agent: Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.72 Safari/537.36
Content-Type: application/json
Referer: https://localhost:444/
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-GB,en-US;q=0.8,en;q=0.6
{"Id":"6","Name":"Test Account 5","Registered":null,"WebsiteUrl":"Testing","IsEnabled":true,"AccountType":"Retailer","Tracking":{"CreatedBy":"JhH1TV-f-P8cZgV19W0bhyI3UBLlHdbh79ZkzhnJSKA","CreatedOn":"2013-07-26T14:08:22.787","ModifiedBy":"JhH1TV-f-P8cZgV19W0bhyI3UBLlHdbh79ZkzhnJSKA","ModifiedOn":"2013-07-26T16:54:20.57","Timestamp":"AAAAAAAADJ0="}}
Here is an example of the response.
HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-Type: application/json; charset=utf-8
Expires: -1
ETag: "AAAAAAAADJ4="
Access-Control-Allow-Origin: *
DataServiceVersion: 3.0
Date: Fri, 26 Jul 2013 17:05:14 GMT
Content-Length: 425
{
"odata.metadata":"https://localhost:446/admin/v2/%24metadata#accounts/@Element","Id":6,"Name":"Test Account 5","Registered":null,"WebsiteUrl":"Testing","IsEnabled":true,"AccountType":"Retailer","Tracking":{
"CreatedBy":"JhH1TV-f-P8cZgV19W0bhyI3UBLlHdbh79ZkzhnJSKA","CreatedOn":"2013-07-26T14:08:22.787","ModifiedBy":"JhH1TV-f-P8cZgV19W0bhyI3UBLlHdbh79ZkzhnJSKA","ModifiedOn":"2013-07-26T17:05:13.9989111Z","Timestamp":"AAAAAAAADJ4="
}
}
As you can see the ETag/Timestamp have been updated.
Any suggestions
Regards
Richard....