http.Client
's .Do
method, Gosip HTTP Client's methods proceed and read response body to return array of bytes. Which reduce amount of scaffolded code a bit and more handy for the REST API consumption, in our opinion, which is 90% of use cases.GET
request, embeds "Accept": "application/json;odata=verbose"
header as a default. Use it for REST API GET
calls.POST
request, embeds "Accept": "application/json;odata=verbose"
and "Content-Type": "application/json;odata=verbose;charset=utf-8"
headers as default. X-RequestDigest is received, cached, and embed automattically. Use it for REST API POST
calls.POST
request, embeds "Accept": "application/json;odata=verbose"
, "Content-Type": "application/json;odata=verbose;charset=utf-8"
, and "X-Http-Method": "DELETE"
headers as default. X-RequestDigest is received, cached, and embed automattically. Use it for REST API POST
calls with delete resource intention.POST
request, embeds "Accept": "application/json;odata=verbose"
, "Content-Type": "application/json;odata=verbose;charset=utf-8"
, and "X-Http-Method": "MERGE"
headers as default. X-RequestDigest is received, cached, and embed automattically. Use it for REST API POST
calls with update resource intention.POST
request to /_vti_bin/client.svc/ProcessQuery
endpoint (CSOM). All required headers for a CSOM request are embed automatically. Method's body should stand for a valid CSOM XML package. The response body is parsed for error handling, yet returned in it's original form.Execute
method which is a wrapper function injecting SharePoint authentication and ending up calling http.Client's Do
method.*http.Request
at this point it's just a standard request from "net/http" package, but authenticated to SharePoint and with some batteries under the hood for a seemles API integration.