Rest API; Request works in postman but not HttpClient

Spencer Poole August 11, 2022

Hello, everyone!

I am currently encountering a strange issue when trying to use the JIRA API and basic authentication.

I have made an http request that works successfully in postman and from my app in angularjs:
postmanrquest.png

However, I have now tried to replicate this request in my c# code for my web api and the request never seems to work. Sending the request from here doesn't reflect any use of the api token when checking my api tokens on the JIRA website.
apicode.png
I have replaced my base64encoded password here with $$$$ just for this post.

My response is always:response.png
Why would this request be working in postman but not in my c# code with httpclient? I have tried re-writing this many different ways.

1 answer

0 votes
Neil
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 12, 2022

Hi @Spencer Poole. Welcome also to the user community!  :-)  Just an FYI, I saw your post on the Atlassian Developer Community forums earlier today, and sent over a suggestion to help debug the problem you're having:

https://community.developer.atlassian.com/t/rest-api-basic-auth-request-works-in-postman-but-not-httpclient/60641/2

p.s. Side note: be sure to change the URL in your C# code to call https, not http.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events