Question

Connection to Jira Service Management API

  • 7 March 2024
  • 4 replies
  • 37 views

Userlevel 1
Badge +1

Hey Team,

Having a heck of a time getting a successful result from a connection attempt to our instance of Jira Service Management.  I have followed the API documentation I think to a “T,” but need a bit of a push if anyone has implemented this before.

The ultimate goal is to eventually create new Organizations after they show up in another internal system, but during my troubleshooting, I am scaling back and just trying to get a successful result by using GET Organizations.  Here is the setup:

 

 

After this step, I provide my Jira credentials and successfully connect.

 

 

Here is the error:

The only odd thing I found is in the API doco, it also shows an additional HTTP Header of “Authorization: Bearer <API Token.”  I originally did not add this since my assumption was since I could successfully connect using my credentials, along with the note of “Authentication headers are included automatically,” this was not needed.  However, I did generate a token and added this header, but it resulted in the same error.

I did play around with the HTTP method and was able to somehow bypass the error by using PATCH, but the result was a 401 - Bad Request, and I believe I need to use PUT to create a new Organization and not PATCH. But again, for now I am trying to scale back by getting a simple example to work.  FWIW, when I enter the main URL in my browser, I get a listing of Organizations.


4 replies

Userlevel 7
Badge +14

Hi @PatrickD 

Try using AI to help you create a custom Zap action.

 

Userlevel 1
Badge +1

Thank you, Troy.  I have tried this option as well to no avail.  I feel it may have something to do with the Headers but haven’t been able to resolve as of yet.  When I run the call through Postman (API testing tool), it works.

Only change to the original post is I have added an Authorization Header in the format of Basic myemailaddress:<JiraAccessToken>.

 

I was hoping someone in the community has successfully made this connection and could share their setup.

Userlevel 2
Badge +1

I suspect that the basic header you are sending isn’t base64 encoded. To most straightforwardly confirm this, I would go to webhook.site, get a URL from there. Replace the jira URL you are putting into both Zapier and Postman with that URL. Then send requests. Look at webhook.site to see the two requests that came through. Compare the headers - that will probably tell you where the meaningful difference is. At that point, it’s just mechanical work to make whatever change in Zapier will bring it in line with Postman! 

Userlevel 1
Badge +1

Hey Raydeck,

Thank you for the feedback.  I found several references regarding the Jira token needing to be base64 encoded, which did not work, but nothing beyond that.  I attempted to configure Zapier identical to Postman and even had Atlassian support on chat at the same time and none of their recommendations worked.

Regardless, I decided to move on and I ended up using a Code by Zapier action using a Python script instead and this worked the very first time.  I simply used the headers outlined in the Jira API documentation.  Only difference is the Authentication needed to be Basic vs. Bearer:

 

headers = {    "Accept": "application/json",    "Authorization": f"Basic {credentials}",    "Content-Type": "application/json"}

Reply