In this example, we're using the following API:
Description
Adds a new document (file) into the system and associates it with the provided artifact (optional) and project folder/type (optional)
The file must be converted into an array of bytes and then converted into a base64 string.
How to Execute
To access this REST web service, you need to use the following URL (make sure to replace any parameters (eg {project_id}) with the relevant value (e.g.1 for project PR1).
Sample Code
- Method: POST
- URL: projects/{project_id}/documents/file
- Accept: application/json
- Content-Type: application/json
Body
{
"BinaryData": "iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAARElEQVR42u3PMREAAAgEoDe50TWDqwcNqEw6D5SIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIiIyMUCa5JKzyMlqNAAAAAASUVORK5CYII=",
"AttachedArtifacts": [{"ArtifactId": 4, "ArtifactTypeId": 2}],
"AuthorId": 1,
"FilenameOrUrl": "Sample.png",
"Description": "Sample Image",
"Size": 100,
"CurrentVersion": "1.0",
"ProjectId": 1,
"Tags": "tag1, tag2"
}