Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,293,291
Community Members
 
Community Events
165
Community Groups

upload attachment from topdesk to jira via rest api.

Edited

Our support team works with Topdesk and our dev team works with Jira. We are setting up communication between both tools. We can already send text, but with the images it's going wrong. I receive a status 200, but in the return i have an empty body.

 

I only can use json(with freemarker) to build the code.

 

What is have is:

jira1.PNG

This returns:

==========================================================================

Step 1 'getListOfAttachments'
[2019-08-30T07:28:27.296180Z] Starting FreeMarker template processing
[2019-08-30T07:28:27.297180200Z] Finished FreeMarker template processing
[2019-08-30T07:28:27.297180200Z] Request: GET https://******/attachments
Request headers: {Authorization=[Basic ******], Content-Type=[application/json]}
[2019-08-30T07:28:28.420971100Z] Response status: 206 Partial Content
Response headers: {Date=[Fri, 30 Aug 2019 07:28:28 GMT], Content-Type=[application/json;charset=utf-8], Content-Length=[4124], Connection=[keep-alive], Set-Cookie=[__cfduid=d7790c127f050694e1bf2256a36837f1b1567150107; expires=Sat, 29-Aug-20 07:28:27 GMT; path=/; domain=.topdesk.net; HttpOnly], Cache-Control=[no-store], CF-Ray=[50e50c4a6a30bf37-AMS], Access-Control-Allow-Origin=[*], Expect-CT=[max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"], Strict-Transport-Security=[max-age=31536000; includeSubDomains; preload], X-Content-Type-Options=[nosniff], X-Robots-Tag=[noindex,nofollow], X-XSS-Protection=[1; mode=block], Vary=[Accept-Encoding], Server=[cloudflare]}
Response body: [{"id":"1d5c37b6-ac05-4048-9f1b-2f3ee2681e9e","fileName":"iectx (8).png","downloadUrl":"/tas/api/incidents/id/f422740b-e0a1-4263-a209-7f0d78a6d8fc/attachments/1d5c37b6-ac05-4048-9f1b-2f3ee2681e9e/download","size":19654,"description":null,"invisibleForCaller":false,"entryDate":"2019-08-22T13:43:10.000+0000","operator":{"id":"c2eba81b-6b9c-45f2-aac9-3e1c5ccc1b0a","name":"Jürgen (ADMIN) Lehoucke"},"person":null},{"id":"5b7cd644-8a2b-42ec-b4e3-a9a62e652d3b","fileName":"iectx (7).png","downloadUrl":"/tas/api/incidents/id/f422740b-e0a1-4263-a209-7f0d78a6d8fc/attachments/5b7cd644-8a2b-42ec-b4e3-a9a62e652d3b/download","size":19654,"description":null,"invisibleForCaller":false,"entryDate":"2019-08-22T12:49:58.000+0000","operator":{"id":"c2eba81b-6b9c-45f2-aac9-3e1c5ccc1b0a","name":"Jürgen (ADMIN) Lehoucke"},"person":null},{"id":"8c486610-5c83-4d43-aa71-3ae17cedc0f4","fileName":"iectx (6).png","downloadUrl":"/tas/api/incidents/id/f422740b-e0a1-4263-a209-7f0d78a6d8fc/attachments/8c486610-5c83-4d43-aa71-3ae17cedc0f4/download","size":19654,"description":null,"invisibleForCaller":false,"entryDate":"2019-08-22T08:27:42.000+0000","operator":{"id":"c2eba81b-6b9c-45f2-aac9-3e1c5ccc1b0a","name":"Jürgen (ADMIN) Lehoucke"},"person":null},{"id":"2622d602-887c-4e3d-8516-88899eda1eef","fileName":"iectx (5).png","downloadUrl":"/tas/api/incidents/id/f422740b-e0a1-4263-a209-7f0d78a6d8fc/attachments/2622d602-887c-4e3d-8516-88899eda1eef/download","size":19654,"description":null,"invisibleForCaller":false,"entryDate":"2019-08-20T17:11:13.000+0000","operator":{"id":"c2eba81b-6b9c-45f2-aac9-3e1c5ccc1b0a","name":"Jürgen (ADMIN) Lehoucke"},"person":null},{"id":"916291bf-bb1b-4367-9a38-d58f58f5dd53","fileName":"iectx (4).png","downloadUrl":"/tas/api/incidents/id/f422740b-e0a1-4263-a209-7f0d78a6d8fc/attachments/916291bf-bb1b-4367-9a38-d58f58f5dd53/download","size":19654,"description":null,"invisibleForCaller":false,"entryDate":"2019-08-20T16:31:13.000+0000","operator":{"id":"c2eba81b-6b9c-45f2-aac9-3e1c5ccc1b0a","name":"Jürgen (ADMIN) Lehoucke"},"person":null},{"id":"20c2d785-a25c-448b-abc1-8c054e8b758d","fileName":"iectx (3).png","downloadUrl":"/tas/api/incidents/id/f422740b-e0a1-4263-a209-7f0d78a6d8fc/attachments/20c2d785-a25c-448b-abc1-8c054e8b758d/download","size":19654,"description":null,"invisibleForCaller":false,"entryDate":"2019-08-20T16:28:19.000+0000","operator":{"id":"c2eba81b-6b9c-45f2-aac9-3e1c5ccc1b0a","name":"Jürgen (ADMIN) Lehoucke"},"person":null},{"id":"b19c0b0e-a8bf-4f04-9709-862859aed9d1","fileName":"iectx (2).png","downloadUrl":"/tas/api/incidents/id/f422740b-e0a1-4263-a209-7f0d78a6d8fc/attachments/b19c0b0e-a8bf-4f04-9709-862859aed9d1/download","size":19654,"description":null,"invisibleForCaller":false,"entryDate":"2019-08-20T16:23:59.000+0000","operator":{"id":"c2eba81b-6b9c-45f2-aac9-3e1c5ccc1b0a","name":"Jürgen (ADMIN) Lehoucke"},"person":null},{"id":"01b9699c-f5f1-4f51-b0df-774f4079bf4a","fileName":"iectx (1).png","downloadUrl":"/tas/api/incidents/id/f422740b-e0a1-4263-a209-7f0d78a6d8fc/attachments/01b9699c-f5f1-4f51-b0df-774f4079bf4a/download","size":19654,"description":null,"invisibleForCaller":false,"entryDate":"2019-08-20T16:10:36.000+0000","operator":{"id":"c2eba81b-6b9c-45f2-aac9-3e1c5ccc1b0a","name":"Jürgen (ADMIN) Lehoucke"},"person":null},{"id":"280c4b20-6493-4c5e-af65-a329e275e940","fileName":"iectx.png","downloadUrl":"/tas/api/incidents/id/f422740b-e0a1-4263-a209-7f0d78a6d8fc/attachments/280c4b20-6493-4c5e-af65-a329e275e940/download","size":19654,"description":null,"invisibleForCaller":false,"entryDate":"2019-08-20T14:56:49.000+0000","operator":{"id":"c2eba81b-6b9c-45f2-aac9-3e1c5ccc1b0a","name":"Jürgen (ADMIN) Lehoucke"},"person":null},{"id":"918be7a8-3d33-4d8d-aa00-b8f3441561b5","fileName":"8200Uc.PNG","downloadUrl":"/tas/api/incidents/id/f422740b-e0a1-4263-a209-7f0d78a6d8fc/attachments/918be7a8-3d33-4d8d-aa00-b8f3441561b5/download","size":19514,"description":null,"invisibleForCaller":false,"entryDate":"2019-08-20T14:40:50.000+0000","operator":{"id":"c2eba81b-6b9c-45f2-aac9-3e1c5ccc1b0a","name":"Jürgen (ADMIN) Lehoucke"},"person":null}]
[2019-08-30T07:28:28.420971100Z] Storing response data
[2019-08-30T07:28:28.421982300Z] Successfully finished step 'getListOfAttachments'

==========================================================================

Step 2 'downloadFirstAttachment'
[2019-08-30T07:28:28.421982300Z] Starting FreeMarker template processing
[2019-08-30T07:28:28.421982300Z] Finished FreeMarker template processing
[2019-08-30T07:28:28.421982300Z] Request: GET ******/attachments/1d5c37b6-ac05-4048-9f1b-2f3ee2681e9e/download
Request headers: {Authorization=[Basic ******], Content-Type=[application/json]}
[2019-08-30T07:28:28.664058100Z] Response status: 200 OK
Response headers: {Date=[Fri, 30 Aug 2019 07:28:28 GMT], Content-Type=[image/png;charset=utf-8], Content-Length=[19654], Connection=[keep-alive], Set-Cookie=[__cfduid=d39d528a8de105c9e37c8d3ce978fb8791567150108; expires=Sat, 29-Aug-20 07:28:28 GMT; path=/; domain=.topdesk.net; HttpOnly], Cache-Control=[no-store], CF-Ray=[50e50c515aff9c99-AMS], Access-Control-Allow-Origin=[*], Content-Disposition=[attachment; filename="iectx (8).png"; filename*=UTF-8''iectx%20%288%29%2Epng], Expect-CT=[max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"], Strict-Transport-Security=[max-age=31536000; includeSubDomains; preload], X-Content-Type-Options=[nosniff], X-Robots-Tag=[noindex,nofollow], X-XSS-Protection=[1; mode=block], Vary=[Accept-Encoding], Server=[cloudflare]}
Response body: �PNG


IHDRe���+sRGB���gAMA�� �a ......... (lot more sign's/code but i cut them off in this post)
[2019-08-30T07:28:28.664058100Z] Storing response data
[2019-08-30T07:28:28.664058100Z] Successfully finished step 'downloadFirstAttachment'

==========================================================================

 

when I post this picture to our topdesk enviroment, it works perfect

jira2.PNG

When i try to do the same to jira:

 

jira3.PNG

 

I get the following response:

Step 5 'UploadJira2'
[2019-08-30T07:28:30.416467600Z] Starting FreeMarker template processing
[2019-08-30T07:28:30.417467700Z] Finished FreeMarker template processing
[2019-08-30T07:28:30.417467700Z] Request: POST https://******/rest/api/2/issue/HORA-83950/attachments
Request headers: {Authorization=[Basic *****], X-Atlassian-Token=[nocheck], Content-Type=[multipart/form-data; boundary=BOUNDARY]}
Request body: BOUNDARY--
"Content-Type": "image/png";"charset"="utf-8"
Content-Transfer-Encoding: binary
Content-Type: application/octet-stream; "name"="file"; "filename"="iectx (8).png"; "key"="file";

file:"�PNG


IHDR.......(lot more sign's/code but i cut them off in this post)
BOUNDARY--
[2019-08-30T07:28:30.599478700Z] Response status: 200 200
Response headers: {Date=[Fri, 30 Aug 2019 07:28:30 GMT], Server=[Apache], X-AREQUESTID=[568x12315x1], X-XSS-Protection=[1; mode=block], X-Content-Type-Options=[nosniff], X-Frame-Options=[SAMEORIGIN], Content-Security-Policy=[frame-ancestors 'self'], X-ASEN=[SEN-L12537288], X-Seraph-LoginReason=[OK], X-ASESSIONID=[m8ea5g], X-AUSERNAME=[TopdeskConnection], Cache-Control=[no-cache, no-store, no-transform], Content-Type=[application/json;charset=UTF-8], Set-Cookie=[JSESSIONID=A4F6E33DE5FF077CD32C3318906BDCA2; Path=/jira; Secure; HttpOnly, atlassian.xsrf.token=BIMZ-26KK-G8Y7-TJMK_c46de5464bb96f1108f44bd5339878f82c6b4707_lin; Path=/jira; Secure, dtCookie=70452A76B2E1FEF16E0DAB8065E28AE6|SmlyYXwx; Path=/; Domain=.***.be], Keep-Alive=[timeout=5, max=100], Connection=[Keep-Alive], Transfer-Encoding=[chunked], Content-Length=[-1]}
Response body: []
[2019-08-30T07:28:30.599478700Z] Storing response data
[2019-08-30T07:28:30.600479600Z] Successfully finished step 'UploadJira2'

---------------------------------------------------------------------------------------

 

When i look into the log's of jira, i see there communication, but i can't find the attachment.

 

Does anybody has an idee to fix this?

2 answers

0 votes
dw I'm New Here May 12, 2022

Hello,

I'm facing the same problem. Did you found any solution?

Hi there,

Next week, we will release a new version of our TOPdesk Jira integration which makes it possible to view actions and attachments sent from TOPdesk in a Jira issue. 

You can start your trial here: TOPdesk Jira integration

If there are any questions, please reach out to us: support.

Best wishes,

Elise

Hey Jurgen. I understand your pain. One of our clients was also using TOPdesk and wanted to sync everything with Jira comments, attachments, various fields etc. and got stuck in the middle of the internal development process. 

We recommended this tool to them - ZigiOps and I believe it did a good job. 

Hope this helps. 

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you