Retrieving document metadata
On this page
You can obtain the metadata (title, description, type, etc) of a document by sending a specific HTTP GET request to the Jira instance running this version of Documents app. The result is returned in JSON format.
Request URL
The request URL takes the following form:
https:/ /MY_JIRA_BASE_URL/plugins/servlet/stonikbyte/projectdocs/get-document-metadata?documentKey=X
Replace "https:/ /MY_JIRA_BASE_URL" with the base URL of your Jira server.
Parameters
You have to specify the following parameters:
Parameter | Description |
---|---|
documentKey | Represents the key (unique identifier) of the document. All documents containing this value will be retrieved. Search is not key sensitive. Leave it blank to retrieve all documents. The parameter has to be URL encoded. |
An example of the request URL with parameters is as follows:
https:/ /myjiraserver:2990/jira/plugins/servlet/stonikbyte/projectdocs/get-document-metadata?documentKey=31
In this example, the metadata of document with the key 31 is returned.
A successful response
An HTTP 200 status response indicates a successful request. The following data about the matching documents is returned:
Data | Description | Example |
---|---|---|
id | The key (unique identifier) of the document | 31 |
type | The type of the document. | 1 |
parentType | The type of the document's parent. | 1 |
title | The Title of the document | Project Plan |
jiraProjectID | The ID of the Jira project the document belong to. | 1000 |
originalFileName | The name of the attached file. | ProjectPlan.pptx |
originalFileExtension | The extension of the attached file. | pptx |
target | The internal name of the attached file for a document of type File or the target URL in case of a document of type URL | |
jiraProjectID | The ID of the Jira project the document belongs to. | 1000 |
title | The description of the document | text |
addedbyUserKey | The key of the user who added the document | admin |
addedByUserDirectoryId | The directory ID of the user who added the document | 1 |
dateAdded | The date when the document was added (UTC Time) | 12/09/2014 21:27:12 |
currentRevisionDescription | The Current Revision Description of the document | text |
currentRevision | The Current Revision of the document | text |
currentRevisionAuthors | The Current Revision Author of the document | text |
internalVersion | The current version of the document | 2 |
fileSize | The size of the attached file in bytes | 34696 |
Error Response
If the REST call fails, the service returns one of the following HTTP statuses:
HTTP Status Code | Description |
---|---|
401 Unauthorized | Returned for unauthenticated requests or missing View permissions. |
412 Precondition failed | Returned if the document key parameter was not specified or if the license of the Documents app is invalid. |
Â