API request, working in Postman but not C#
I'm trying to call a certain API and then get a response back. When I run the code in Postman it works fine, I get the right response. But when I run it in C#, I get 403 forbidden. If I run the code in Postman without the JSON body, then I get 400 bad request. So I know it's not the JSON that's the issue, meaning it's probably the headers. Could someone give me a hint at what I should look at to solve this problem?


11 Replies
403 suggests an authentication issue
are you using the same credentials for both requests?
there are no credentials/no auth it's not required)

Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
I do think I have that, I'm not really familiar with the concept however. I just removed this serialization for debugging purposes and put the actual JSON instead
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
Basically followed this tutorial https://tutorials.eu/how-to-call-post-api-in-csharp/
Jafar Jabbarzadeh
TutorialsEU
How to call POST API in C# | TutorialsEU
In this article, we will create a simple project demonstrating how to call Post API in C# and how to serialize and deserialize C# objects to and from JSON.
but then I have to deal with tasks and stuff :(
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
anyways
if we disregard this
because I'm pretty sure the JSON is not the problem
the problem is the headers I think
Any1 got any idea?
start by making your postman and C# requests match exactly, then remove things until you find what triggers the issue