Survey data
Create a new file on current asset
Fields:
- asset (required)
- user (required)
- description (required)
- file_type (required)
- content (as binary) (optional)
- metadata JSON (optional)
Notes:
- Files can have different types:
- map_layer
- form_media
- Files can be created with three different ways
- POST a file with content parameter
- POST a base64 encoded string with base64Encoded parameter<sup>1</sup>
- POST an URL with metadata parameter<sup>2</sup>
<sup>1)</sup> metadata becomes mandatory and must contain filename property<br> <sup>2)</sup> metadata becomes mandatory and must contain redirect_url property
Files with form_media type must have unique filename per asset
post/api/v2/assets/{uid_asset}/files/
Request
- The document declares no server URL.
- Auth: one of:
- HTTP basic
- API key in header Authorization
Path parameters
uid_assetstring required
UID of the parent asset
Request body
Response
Example response
{
"url": "https://kf.kobotoolbox.org/api/v2/assets/a3C9wWefqZVkChNLKqqXVZ/files/afSa8PqnoYe8vJqkrsGz3oN/",
"asset": "https://kf.kobotoolbox.org/api/v2/assets/a3C9wWefqZVkChNLKqqXVZ/",
"user": "https://kf.kobotoolbox.org/api/v2/users/bob/",
"content": "https://kf.kobotoolbox.org/api/v2/assets/a3C9wWefqZVkChNLKqqXVZ/files/afSa8PqnoYe8vJqkrsGz3oN/content/"
}Changes
- breaking
removed the required property
from the response with the status
- breaking
- info
added the required property
to the response with the status
- info