Item Endpoint
In the context of our API, an item represents a key entity. This item has been created for the purpose of obtaining and creating images and/or items.
Common Item Characteristicsβ
-
Images (Products, Logos, Banners, Profile Pictures...): Images will be stored as items, with the type image, or the different types for the different windows (
image/jpg,image/jpeg,image/png,image/gif). -
Documents: We can import all types of documents such as (
application/pdf,application/msword,text/csv,application/vnd.ms-excel,application/vnd.ms-powerpoint) -
Compressed Files: The API supports compressed files (
application/zip,application/vnd.rar).
Currently the API only provides endpoints for image uploads.
Endpointsβ
GET/Item/getImageUrlβ
Get all images on the system.
Descriptionβ
This endpoint retrieves a paginated list of all images in the system. It allows clients to retrieve image data based on pagination parameters such as page number (page) and number of items per page (pageSize). The url field allows viewing the image stored on the server.
Parametersβ
| Name | Description | Type | Default Value |
|---|---|---|---|
id | ID, or IdRemote, of the Image | String optional | id |
page | Page number | Integer | 1 |
pageSize | Number of items per page | Integer | 10 |
Responsesβ
JSONβ
{
"data": [
{
"id": "string",
"idRemote": "string",
"type": {
"id": "string",
"description": "string"
},
"name": "string",
"description": "string",
"extension": "string",
"mimeType": "string",
"url": "string",
"highlight": true,
"order": 0,
"origin": "string",
"md5": "string",
"numDownload": 0,
"visible": true,
"active": true,
"resource": [
{
"language": {
"id": "string",
"iso": "string",
"name": "string"
},
"role": {
"id": "string",
"type": "string"
}
}
],
"updatedAt": "string"
}
],
"pagination": {
"totalItems": 0,
"itemsPerPage": 0,
"currentPage": 0,
"totalPages": 0,
"nextPageUrl": "string"
}
}
XMLβ
<?xml version="1.0" encoding="UTF-8"?>
<export>
<data>
<item>
<id>string</id>
<idRemote>string</idRemote>
<type>
<id>string</id>
<description>string</description>
</type>
<name>string</name>
<description>string</description>
<extension>string</extension>
<mimeType>string</mimeType>
<url>string</url>
<highlight>true</highlight>
<order>0</order>
<origin>string</origin>
<md5>string</md5>
<numDownload>0</numDownload>
<visible>true</visible>
<active>true</active>
<resource>
<item>
<language>
<id>string</id>
<iso>string</iso>
<name>string</name>
</language>
<role>
<id>string</id>
<type>string</type>
</role>
</item>
</resource>
<updatedAt>string</updatedAt>
</item>
</data>
<pagination>
<totalItems>0</totalItems>
<itemsPerPage>0</itemsPerPage>
<currentPage>0</currentPage>
<totalPages>0</totalPages>
<nextPageUrl>string</nextPageUrl>
</pagination>
</export>
πTry it outπ±
GET/Item/getItemUrlβ
Get Documents by URL.
Descriptionβ
This endpoint retrieves a paginated list of all non-image documents stored in the system. It allows clients to retrieve item data based on pagination parameters such as page number (page) and number of items per page (pageSize).
Parametersβ
| Name | Description | Type | Default Value |
|---|---|---|---|
id | ID or IdRemote of the Item | String optional | id |
page | Page number | Integer | 1 |
pageSize | Number of items per page | Integer | 10 |
Responsesβ
JSONβ
{
"data": [
{
"id": "string",
"idRemote": "string",
"type": {
"id": "string",
"description": "string"
},
"name": "string",
"description": "string",
"extension": "string",
"mimeType": "string",
"url": "string",
"highlight": true,
"order": 0,
"origin": "string",
"md5" : "string",
"numDownload": 0,
"visible": true,
"active": true,
"resource": [
{
"language": {
"id": "string",
"iso": "string",
"name": "string"
},
"rol": {
"id": "string",
"type": "string"
}
},
],
"updatedAt": "string"
}
],
"pagination": {
"totalItems": 0,
"itemsPerPage": 0,
"currentPage": 0,
"totalPages": 0,
"nextPageUrl": "string"
}
}
XMLβ
<?xml version="1.0" encoding="UTF-8"?>
<export>
<data>
<item>
<id>string</id>
<idRemote>string</idRemote>
<type>
<id>string</id>
<description>string</description>
</type>
<name>string</name>
<description>string</description>
<extension>string</extension>
<mimeType>string</mimeType>
<url>string</url>
<highlight>true</highlight>
<order>0</order>
<origin>string</origin>
<md5>string</md5>
<numDownload>0</numDownload>
<visible>true</visible>
<active>true</active>
<resource>
<language>
<id>string</id>
<iso>string</iso>
<name>string</name>
</language>
<rol>
<id>string</id>
<type>string</type>
</rol>
</resource>
<updatedAt>string</updatedAt>
</item>
</data>
<pagination>
<totalItems>0</totalItems>
<itemsPerPage>0</itemsPerPage>
<currentPage>0</currentPage>
<totalPages>0</totalPages>
<nextPageUrl>string</nextPageUrl>
</pagination>
</export>
πTry it outπ±
POST/Item/createDocumentβ
Importing Base64 Documents: Using the POST Methodβ
This endpoint is designed to upload any type of base64 file to the server.
Details of the POST Method:β
The idRemote field provided when creating a new entity corresponds to the remote idRemote that the user wants to give it. The system will automatically create a local id.
All body parameters are required.
To make a successful request through this endpoint you must attach the body following this JSON schema:
[
{
"idRemote": "string",
"name": "string",
"visible": true,
"base64": "string"
}
]
You can upload multiple documents in a single operation by separating each object within the array with commas.
πTry this endpointπ±
POST/Item/createImageβ
Importing base64 images: Using the POST Methodβ
This endpoint is designed to support only base64 images. To successfully create an image it is crucial to attach it encoded via the base64image parameter. The system takes care of storing it on the server and formatting it.
Details of the POST Method:β
When creating an image we can attach the products with which we want to associate said image. We can add an optional field called products that contains a parameter productId, this parameter can be appended multiple times separated by commas to associate an image with multiple products. If productId corresponds to a generic product, the image will be associated with all its variants.
The idRemote field provided when creating a new entity correspond to the remote idRemote that the user wants to give it. The system will automatically create a local id.
Required Parameters:β
| Name | Description | Type |
|---|---|---|
idRemote | Identifier of the new Image | String |
name | Name to be assigned to the new Image | String |
visible | Determines whether the new Image is visible or not | Boolean |
active | Determines whether the new Image is active or not | Boolean |
default | TODO | Boolean |
md5 | TODO | String |
base64Image | The image encoded in base 64 | String |
Optional? products Parameters : TODOβ
| Name | Description | Type |
|---|---|---|
productId | Identifier of the product, it can be a general product | String |
To create an image via this endpoint you must attach the request body following this JSON schema:
[
{
"idRemote": "string",
"name": "string",
"visible": true,
"active": true,
"default": true,
"md5": "string",
"base64Image": "string",
"products": [
{
"productId": "string"
}
]
}
]
You can upload multiple images in a single operation by separating each object within the array by commas.
Responsesβ
In order not to saturate the server, this endpoint sends a message to a consumer in charge of processing the request. To check the status of the request sent, it is necessary to access the URL attached to the response. A response correctly sent to the consumer should look like this:
{
"code": 201,
"message": "Items message created successfully and dispatched to the queue.",
"statusUrl": "http://host/api/database/v1/message/status/messageId"
}
The statusUrl field redirects us to a more detailed response about the status of the request. A request successfully processed by the consumer looks like this:
{
"data": [
{
"status": "completed",
"errorMessage": null
}
],
"pagination": {
"totalItems": 1,
"itemsPerPage": 10,
"currentPage": 1,
"totalPages": 1,
"nextPageUrl": null
}
}
If any error occurs during message processing, the response will look something like this:
{
"code": 400,
"error": "Invalid item data format, a required parameter is missing"
}
πTry it outπ±
POST/Item/createImageByUrlβ
Importing images by URL: Using the POST Methodβ
If you want to upload an image to the system via a url, you can use this endpoint. The system collects the url attached in the url parameter and stores it on the server.
POST Method Details:β
When creating an image we can attach the products with which we want to associate said image. We can add an optional field called products that contains a parameter productId, this parameter can be appended multiple times separated by commas to associate an image with multiple products. If productId corresponds to a generic product, the image will be associated with all its variants.
The idRemote field provided when creating a new entity correspond to the remote idRemote that the user wants to give it. The system will automatically create a local id. To create an image via this endpoint you must attach the request body following this JSON schema:
Required Parameters:β
| Name | Description | Type |
|---|---|---|
idRemote | Identifier of the new Image | String |
name | Name to be assigned to the new Image | String |
visible | Determines whether the new Image is visible or not | Boolean |
active | Determines whether the new Image is active or not | Boolean |
default | TODO | Boolean |
url | The URL with the new Image | String |
Optional? products Parameters : TODOβ
| Name | Description | Type |
|---|---|---|
productId | Identifier of the product, it can be a general product | String |
To make a successful request through this endpoint you must attach the body following this JSON schema:
[
{
"idRemote": "string",
"name": "string",
"visible": true,
"active": true,
"default": true,
"url": "string",
"products": [
{
"productId": "string"
}
]
}
]
You can upload multiple images in a single operation by separating each object within the array by commas.
Responsesβ
In order not to saturate the server, this endpoint sends a message to a consumer in charge of processing the request. To check the status of the request sent, it is necessary to access the URL attached to the response. A response correctly sent to the consumer should look like this:
{
"code": 201,
"message": "Items message created successfully and dispatched to the queue.",
"statusUrl": "http://host/api/database/v1/message/status/messageId"
}
The statusUrl field redirects us to a more detailed response about the status of the request. A request successfully processed by the consumer looks like this:
{
"data": [
{
"status": "completed",
"errorMessage": null
}
],
"pagination": {
"totalItems": 1,
"itemsPerPage": 10,
"currentPage": 1,
"totalPages": 1,
"nextPageUrl": null
}
}
If any error occurs during message processing, the response will look something like this:
{
"code": 400,
"error": "Invalid item data format, a required parameter is missing"
}
πTry it outπ±
DELETE/Item/delete/{id}β
Removing an existing Item.
Descriptionβ
This endpoint allows deleting items using their unique identifier, which can be either the B2B system's own ID or the ID provided by you when registering the items on our platform. Deleting an item deletes it from both the database and the server.
Parametersβ
| Name | Description | Type |
|---|---|---|
id | Item identifier | String required |
πTry it outπ±
Possible Response Errorsβ
| Error | Response Status | Response Body |
|---|---|---|
| This error occurs when the database name is not registered. It indicates an internal server problem. | 500 | {"code": 500,"error": "This dbs name is not register"} |
| This error occurs when a connection to the database cannot be established. It indicates an internal server problem. | 500 | {"code": 500,"error": "Database connection failed."} |
| This error occurs when the system cannot insert or update records in the test database. | 500 | {"code": 500,"error": "Invalid connection name, you cannot insert in default"} |
| This error occurs when a required parameter is missing in the request. | ||
| 500 | {"code": 500,"error": "Internal server Error "} | |
| This error occurs when server had error. | 400 | {"code": 400,"error": "Parameter $parameter is required"} |
| This error occurs when you are not authorized. | ||
| 400 | {"code": 400,"error": "Bad request"} | |
| This error occurs when the user ... TODO . | 401 | {"code": 401,"error": "Unauthorized."} |
| This error occurs when the specified image type could not be found. | 404 | {"code": 404,"error": "No entity found for type with $id."} |
| This error occurs when you try to insert an image that already exists. | 409 | {"code": 409,"error": "Duplicate entry"} |
| This error occurs when you try to insert an image of a type that is not permitted. | 415 | {"code": 415,"error": "Unsupported media type"} |
| This error occurs when you try to send too many requests in a short period of time. | 429 | {"code": 429,"error": "Too Many Requests"} |