i am trying to call webshipper api . api needs these header
Accept: application/vnd.api+json
Accept-Encoding: gzip, deflate
Accept-Language: en-GB,en-US;q=0.9,en;q=0.8
here is my code
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://bascrm.api.webshipper.io/v2/rate_quotes");
request.Method = "POST";
request.KeepAlive = true;
request.Accept = "application/vnd.api+json";
request.ContentType ="application/vnd.api+json";
request.Headers.Add("Authorization", "Bearer " + token + "");
WebHeaderCollection myWebHeaderCollection = request.Headers;
myWebHeaderCollection.Add("Accept-Language", "en-GB,en-US;q=0.9,en;q=0.8");
myWebHeaderCollection.Add("TransferEncoding", "gzip,deflate");
i getting error 400 bed request
when i change request.Accept = "application/vnd.api+json"; to
request.Accept = "application/json";
it will give error 406 not acceptable
Aucun commentaire:
Enregistrer un commentaire