C# (Httpclient) Code generated from Postman not working #749
Unanswered
BobHillDev
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a working example in Postman and when I generate the C# (HttpClient) code it fails with error 404. I was able to successfully generate the Python code for this and get it running in Python. Has anyone run into similar issues, and if so, how did you resolve it?
Here is the code. Due to sensitivity of API access, the actual URL's and credentials have been placed into constants outside of this function.
` private async Task testAPIAsync()
{
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, HIP_URL);
request.Headers.Add("Accept", "application/JSON");
request.Headers.Add("Auth-Request-Type", "Named-User");
request.Headers.Add("Authorization", HIP_BEARER);
request.Headers.Add("Cookie", "BrowserId=mk-rq3GsEe68Oa_Azf5OOQ; CookieConsentPolicy=0:1; LSKey-c$CookieConsentPolicy=0:1; oinfo=c3RhdHVzPURFTU8mdHlwZT02Jm9pZD0wMEQzUzAwMDAwMDh0emI=");
`
The response that I get is a 404 error, and it seems like it is checking generating the 404 on HIP_REDIRECT_URI and not the HIP_URL in the request created with the POST verb.
Any help on this would be greatly appreciated. I can also share the result of the response if that will help.
Thanks!
Bob
Beta Was this translation helpful? Give feedback.
All reactions