Open zeezment opened 6 years ago
Hi @zeezment, I will try to help you even though it's been a while 🙂
The first thing that comes to mind is the missing Content-Type
header on this request, you should add the following line to your client.
client.DefaultRequestHeaders.Add("Content-Type", "application/xml");
The rest actually looks good, and this would not cause an error with a GET
call. Let me know if this works.
Hey @Lozzano! Thank you so much for responding. I had added the Body Content-Type to the body HttpContent variable i.e.
HttpContent _Body = new StringContent(xmlString, Encoding.UTF8, "application/xml");
but I'll try adding it to the header explicitly and confirm this.
@Lozzano when I added the content-type to the headers I got a "Misused header name. Make sure request headers are used with HttpRequestMessage, response headers with HttpResponseMessage, and content headers with HttpContent objects." and hence as mentioned above I added it to the HttpContent object instead
@zeezment could you let me know what your TenantID on Tradeshift is, and which environment, prod or sandbox you are using to test this one? I would love to have a quick look at your account. Do note that the TenantId isn't secret information so sharing it here isn't considered a security issue.
@andrevalentin I have the same problem. But testing with Postman is OK
Hi,
I know it's been a while since you've worked on integration with Tradeshift but do you by any chance have the sample for dispatching documents to TS or any POST requests? All my GET requests work with your sample code but I get a 401 unauthorized trying to use the same format when dispatching documents from my .net application. The POST requests with the same OAuth 1.0a standard work from Postman. See Code below:
`var url = "https://api.tradeshift.com/tradeshift/rest/external/documents/dispatcher?documentId=" + Guid.NewGuid()+"&documentProfileId=tradeshift.invoice.1.0";
Any assistance would be much appreciated. Thanks