Assets ====== Use this endpoint to obtain details on Salesbox's Assets. Base Endpoint ------------ .. code-block:: text https://segmentai.salesbox.com.br/api/assets Get Asset -------- .. code-block:: text GET /api/assets/{id} Get an individual Asset by ID. **HTTP Request** ``GET /api/assets/ID`` **Response** ``Expected Response Code: 200`` .. code-block:: json { "asset": { "id": 1, "title": "Product Whitepaper", "description": "Some description", "alias": "whitepaper", "language": "en", "isPublished": true, "publishUp": "2024-01-15T10:00:00+00:00", "publishDown": "2024-01-30T10:00:00+00:00", "dateAdded": "2024-01-15T10:00:00+00:00", "createdBy": 1, "createdByUser": "John Smith", "dateModified": "2024-01-15T10:30:47+00:00", "modifiedBy": 1, "modifiedByUser": "John Smith", "downloadCount": 10, "uniqueDownloadCount": 8, "revision": 1, "category": { "createdByUser": "Jane Doe", "modifiedByUser": "Jane Doe", "id": 19, "title": "Whitepapers", "alias": "whitepapers", "description": null, "color": null, "bundle": "asset" }, "extension": "pdf", "mime": "application/pdf", "size": 269128, "downloadUrl": "https://segmentai.salesbox.com.br/api/assets/1:whitepaper" } } **Asset Properties** .. list-table:: :header-rows: 1 * - Name - Type - Description * - ``id`` - int - ID of the Asset * - ``title`` - string - Title/name of the Asset * - ``description`` - string/null - Description of the Asset * - ``alias`` - string - Used to generate the URL for the Asset * - ``language`` - string - Locale of the Asset * - ``isPublished`` - boolean - Published state * - ``publishUp`` - datetime/null - Asset publish date/time * - ``publishDown`` - datetime/null - Asset unpublish date/time * - ``dateAdded`` - datetime - Asset creation date/time * - ``createdBy`` - int - ID of the User that created the Asset * - ``createdByUser`` - string - Name of the User that created the Asset * - ``dateModified`` - datetime/null - Asset modified date/time * - ``modifiedBy`` - int - ID of the User that last modified the Asset * - ``modifiedByUser`` - string - Name of the User that last modified the Asset * - ``downloadCount`` - int - Total number of downloads * - ``uniqueDownloadCount`` - int - Unique number of downloads * - ``revision`` - int - Revision version * - ``category`` - object/null - Object with the Category details * - ``extension`` - string - Extension of the Asset * - ``mime`` - string - Mime type of the Asset * - ``size`` - int - File size of the Asset in bytes * - ``downloadUrl`` - string - Public download URL for the Asset List Assets ---------- .. code-block:: text GET /api/assets Get a list of assets. **Query Parameters** .. list-table:: :header-rows: 1 * - Name - Type - Description * - ``search`` - string - Text to search assets by * - ``page`` - int - Which page to display * - ``limit`` - int - How many records to return * - ``orderBy`` - string - Column to sort by * - ``orderByDir`` - string - Sort direction: asc or desc * - ``status`` - string - Filter by status (published, unpublished) Create Asset ----------- .. code-block:: text POST /api/assets/new Create a new asset. **Request Body** .. list-table:: :header-rows: 1 * - Name - Type - Description * - ``title`` - string - Asset title * - ``description`` - string - Asset description * - ``file`` - file - The file to upload * - ``language`` - string - Asset language code * - ``isPublished`` - boolean - Whether the asset should be published * - ``category`` - int - Category ID Edit Asset --------- .. code-block:: text PATCH /api/assets/{id}/edit Edit an existing asset. **Request Body** Same fields as Create Asset. Delete Asset ----------- .. code-block:: text DELETE /api/assets/{id}/delete Delete an existing asset.