V1 and V2Assets

Create an asset

POST
/api/v1/assets

Upload a new asset to your account

There are two methods for uploading assets to the system:

  • By specifying an url
  • By supplying the content of the asset

Both methods are described in this document

Upload an asset by url

This method allows you to specify an url, the system then tries to download it and add it to your account. There are a few issues that must be taken into account:

  • url must be publicly accessible
  • file must be one of the supported file types
ParameterTypeMandatory
urlstringyes
filenamestring

If no filename is specified, the filename of the asset in the url will be used.

NOTE: This system DOES NOT convert files between formats and if different file format of the requested url and filename are used there could be problems

Upload an asset by filename and content

This method allows you to upload an asset by sending its content (base64 format) in the body of the request.

ParameterTypeMandatory
contentstringyes
filenamestringyes

NOTE: Content field must contain only image data, stripping data:image/XXX;base64,

Authorization

bearerAuth
AuthorizationBearer <token>

Obtain a token via POST /auth/api/get-token (15 minute lifetime), then send it as Authorization: Bearer <token>.

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

curl -X POST 'https://example.com/api/v1/assets' \  -H 'Content-Type: application/json' \  --data-raw '{  "filename": "kettle_blue.jpg",  "url": "https://www.plytix.com/hubfs/Kitchen%20and%20Home%20Products/Enjoy%20Mug%20-%20Blue.jpg"}'
{  "data": [    {      "assigned": false,      "categories": [],      "content_type": "image/jpeg",      "created": "2019-01-26T14:26:24.826240+00:00",      "extension": "jpg",      "file_modified": "2019-01-26T14:26:24.826306",      "file_size": 31885,      "file_type": "IMAGES",      "filename": "kettle_blue.jpg",      "id": "5c4c6e10ca59f4061b800ffa",      "modified": "2019-01-26T14:26:24.827123+00:00",      "n_catalogs": 0,      "n_products": 0,      "status": "ACTIVE",      "thumbnail": "https://files.plytix.com/api/v1.1/thumb/kettle_blue.jpg",      "url": "https://files.plytix.com/api/v1.1/file/public_files/assets/kettle_blue.jpg"    }  ]}