Update free access document
The Update free access document method is used to update a reseller's document that can be accessed without the manager's token.
An API token of a manager is required for authorization. To get an API token via the Operator Control Panel, see Viewing and updating manager's information.
The manager's API token specified in an API request determines:
- The role and access level of the manager, which determine the availability of a method.
- The current reseller and downstream resellers accessible within a method.
PUT {base_url}/api/v3/resellers/{reseller_id}/free_access_documents/{free_access_document_id}
Arguments
Name | Parameter Type | Data type | Required/Optional | Description |
---|---|---|---|---|
X-Api-Token | header | string | Required | API token of a manager that performs the operation (see Viewing and updating manager's information) |
Content-Type | header | string | Required | Media type of the request. Specify the following: application/vnd.api+json |
Accept | header | string | Required | Supported media types of the answer. Specify the following: application/vnd.api+json |
base_url | path | string | Required | ActivePlatform URL |
reseller_id | path | number | Required | ID of the current reseller or any of its downstream resellers (see Viewing and updating reseller general information) |
free_access_document_id | path | number | Required | Document ID |
file | form | string | Required | Document in the base64 encoding including its MIME-type (see Media type). The following file types are supported:
The maximum file size of a document is defined by the settings of the given installation of the platform. To change the limit, please contact the support team. Data format:
|
name | form | string | Required | Document name |
Response model
Name | Data type | Description | ||||
---|---|---|---|---|---|---|
data | object | Response data | ||||
id | string | Document ID in the platform | ||||
type | string | Data type | ||||
attributes | object | Document information | ||||
created_at | string | Date and time of the document creation | ||||
updated_at | string | Data and time of the document last update | ||||
name | string | Document name | ||||
url | string | New link to the file of the document in the public file storage |
Errors
The method responds with the 500 Internal Server Error status if the file
attribute was specified incorrectly:
- Missing a coma before the file contents.
- The file extension cannot be identified based on the file contents and the specified content-type.
Request example
PUT /api/v3/resellers/1/free_access_documents/56
Host: test.activeplatform.com
Content-Type: application/vnd.api+json
X-Api-Token: vY5fwetestK3gJXZH5uHCw
Accept: application/vnd.api+json
{
"file": "data:application/pdf;base64,'SSBob2xkIHRoZSBwb3NpdGlvbiBvZiBhIHFhIGVuZ2luZWVyLiBRQSBlbmdpbmVlciByZXNwb25zaWJpbGl0aWVzIGluY2x1ZGUgZGVzaWduaW5nIGFuZCBpbXBsZW1lbnRpbmcgdGVzdHMsIGRlYnVnZ2luZyBhbmQgZGVmaW5pbmcgY29ycmVjdGl2ZSBhY3Rpb25zLiBJIGFsc28gcmV2aWV3IHN5c3RlbSByZXF1aXJlbWVudHMgYW5kIHRyYWNrIHF1YWxpdHkgYXNzdXJhbmNlIG1ldHJpY3MgKGUuZy4gZGVmZWN0IGRlbnNpdGllcyBhbmQgb3BlbiBkZWZlY3QgY291bnRzLikgVGhlIFFBIHRlY2huaWNpYW4gcm9sZSBwbGF5cyBhbiBpbXBvcnRhbnQgcGFydCBpbiBvdXIgY29tcGFueeKAmXMgcHJvZHVjdCBkZXZlbG9wbWVudCBwcm9jZXNzLg=='",
"name": "1.pdf"
}
Response example
{
"data": {
"id": "56",
"type": "free_access_documents",
"attributes": {
"created_at": "2020-10-09T16:49:19.699819+0300",
"updated_at": "2020-10-09T17:02:40.984184+0300",
"name": "1.pdf",
"url": "https://storage.test.activeplatform.com/public/free_access_documents/3231ef9932570a653b9ca71603d4373c.pdf"
}
}
}