-
Notifications
You must be signed in to change notification settings - Fork 446
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support for E-Tags #35
Comments
Yes we could use this. :) Thanks, On Jan 20, 2012, at 12:06 PM, "Prabir Shrestha" reply@reply.github.com wrote:
|
added etag support for sync methods. Does not yet work for batch requests and async methods. The ETag is calculated using the entire response from the API call including its formatting. Developers should be aware that the formatting of API response output may be impacted by the user agent string. Therefore, calls originating from the same client should keep the user agent consistent between calls. (https://developers.facebook.com/blog/post/627/)
Normal request still works like v5.
For etag you need to pass the special parameter called etag
This will tell the fb c# sdk to return a JsonObject with headers and body.
then the you can use the etag from the previous response to get the next responses.
Note: result1.header.ETag (make sure ETag contains the right capitalization). It is exactly how Facebook returns the response header. |
Sample code for using etag with async methods. Note: If you are using XAsync methods make sure to use different instance of FacebookClient. Use same instance only if you are using with XTaskAsync.
|
Here is an example of using etags in batch requests. var fb = new FacebookClient(accessToken);
dynamic result = fb.Batch(
new FacebookBatchParameter("me", new { _etag_ = string.Empty }),
new FacebookBatchParameter("me", new { _etag_ = "\"ac9e51b60e883e294cc98f35f70a1ec8fdf0e736\"" }),
new FacebookBatchParameter("me") { Data = new { headers = new Dictionary<string, object> { { "If-None-Match", "\"ac9e51b60e883e294cc98f35f70a1ec8fdf0e736\"" } } } }); |
https://developers.facebook.com/blog/post/627/
We would most probably want a method that looks similar to this.
Then result.body actually contains the actual json result.
etag parameter is a special parameter like the "access_token" parameter. it should be set as a request header instead of normal parameter.
The text was updated successfully, but these errors were encountered: