I'm trying uploading an attachment to an issue using OAuth, but it's throwing error. can anybody help to show how it works? what headers it requires and how it accepts the files.
Everything else is working fine, only attachment is not working.
Hi Sajan,
You can follow the guide provided by Atlassian here: https://developer.atlassian.com/cloud/jira/platform/jira-rest-api-oauth-authentication/
However, to use OAuth, you'll need to create a java client while using this guide.
Thanks,
Ankit
Thanks, Ankit I have configured everything required for communication. I'm able to create issues successfully, only the attachment part which is left.
I need to know how the Jira system accepts the attachments? what params are required?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Adding an attachment has a different endpoint. /rest/api/3/issue/<Issue-Key>/attachments
It has to be sent as a Multipart form data. If you're using curl, you can send the local file as attachment using -F option and it must be a file.
curl -F "file=@localfile.txt" https://your-domain.atlassian.net/rest/api/3/issue/<Issue-Key>/attachments
If you're using the Java Client Library, you can use MultipartEntityBuilder to do the same.
You can find more info here: https://developer.atlassian.com/cloud/jira/platform/rest/v3/#api-rest-api-3-issue-issueIdOrKey-attachments-post
However, I'll recommend testing this endpoint on Postman first. You can test it out with basic authentication/API key when using postman since you're only trying to test attachments. You'll find step by step instructions here: https://medium.com/@vdespa/automatically-testing-file-uploads-multipart-form-data-with-postman-and-gitlab-ci-ebfa371992b1
Thanks,
Ankit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.