Wiki
Clone wikiFile Field for JIRA / Apwide File Field REST API
Apwide File Field REST API
You can download, upload and attach files to any Apwide File Custom Field with the following 3 endpoints:
Download an existing file
You must use this enpdoint and make a GET:
#!sh GET {server:port}/{your-jira-context}/rest/apwide/document/1.0/file/{issueId}/{fieldId}
- issueId: numerical id of the issue (ex: 10234)
- fieldId: key of the apwide custom field (ex: customfield_10345)
N.B. you must be authenticated and your user must have permissions to view the issue. Check general documentation of JIRA API below if you are not familiar with that.
Upload a new file
You must make a POST:
#!sh POST {server:port}/{your-jira-context}/rest/apwide/document/1.0/file?fileName=YourFileName.example
- Body: content of your file (text or binary)
- fileName: the desired file name that will be displayed in JIRA
It will then return you the fileId. The fileId is the unique key of the document. It is also the value that is stored in JIRA as custom field value. You must keep this fileId to update your issues in the next step.
Update your Apwide Field Customfield with previously uploaded file(s)
#!sh PUT {server:port}/{your-jira-context}/rest/api/2/issue/{issueIdOrKey}
Example of Body :
#!json { "fields" : { "customfield_10602": "your generated file id" } }
JIRA Documentation and tools
General documentation of JIRA API: https://docs.atlassian.com/software/jira/docs/api/REST/7.6.1/
Check also this free add-on that is very convenient to browse the REST API of JIRA: https://marketplace.atlassian.com/plugins/com.atlassian.labs.rest-api-browser/server/overview
Note that you have to disable "Show only public API's" in order to see API's of third party plugins like Apwide File Fields.
Screenshots above were done with the REST API Browser plugin.
(version 1.1.+) Download an existing file by its unique ID
You must use this enpdoint and make a GET:
#!sh GET {server:port}/{your-jira-context}/rest/apwide/document/1.0/file/{documentId}
- documentId: unique id of the file stored in the customfield (ex: 1544184648025_10000_file-field-1.0.5.jar.zip)
N.B. You must be authenticated and your user must have Jira administration permissions. Check general documentation of JIRA API below if you are not familiar with that.
(version 1.1.+) Remove an existing file by its unique ID
You must use this enpdoint and make a DELETE:
#!sh DELETE {server:port}/{your-jira-context}/rest/apwide/document/1.0/file/{documentId}
- documentId: unique id of the file stored in the customfield (ex: 1544184648025_10000_file-field-1.0.5.jar.zip)
N.B. You must be authenticated and your user must have Jira administration permissions. Check general documentation of JIRA API below if you are not familiar with that.
Enjoy!
About apwide
Updated