API in Data Hub
DJUST's Data Hub offers API capabilities to import data.
Currently, the following entities can be imported using the API:
The API connector works only with REST architecture APIs and does not work with SOAP or GraphQL APIs.
This feature is still under development. This page will be updated according to the latest available changes.
Authentication
The authentication is performed through an API key provided in the header. This depends on how you configured your endpoint on your end.
DJUST does not handle token-based authentications such as OAuth2 or basic authentication.
HTTP methods
There are five methods to choose from depending on the action to be performed on the resource:
Method | Description |
---|---|
GET | Retrieve existing data. |
POST | Create new data. |
PUT | Edit existing data. |
DELETE | Erase data. |
PATCH | Partially edit data without replacing it. |
Chaining
You can perform a series of API requests successively and automate sequential processes. Each call is conditioned by the result(s) of the previous one.
For this, use the + Add a call tab and configure each call as desired:
API usage patterns
Default
The default behaviour only performs the call using the chosen method.
Download
Allows retrieving a file available at a URL returned in the API call responsen using the GET method. Specify the property's name where the file download link is located: it can be an URL path or a variable previously called.
Example with URL
Example with a variable
Paging
Pagination allows optimizing query performance by limiting the amount of collected data in pages. When the API is called, pages are exported in a file.
Parameter | Description |
---|---|
Page number parameter name | Name of the query parameter referring to the page number |
Page size parameter name | Name of the query parameter containing the number of entries to return |
Total pages finder path | JSON path ($.varName ) to retrieve the total page value returned by the API |
First page number | First page number. Usually 0. |
Page size | Page size to fetch |
Content finder path | JSON path to retrieve the returned content |
Example
- Name of the property that defines the page number:
pageNumber
- First expected page:
1
- Name of the property that defines the number of entries (in this case, products) to return:
pageSize
- Expected page size, number of elements returned:
1
- Name of the property that defines the total number of pages:
totalPages
- Name of the paginated content:
elements
At the start of the job, I receive the items according to the desired
pagination. The JSON body returns a limited number of products (in the example,
one product) as defined in the request. It should be noted that the response
also contains a paging
property that shows the configured pagination.
Response example
{
"paging": {
"pageNumber": 1,
"pageSize": 1,
"totalPages": 2399,
"totalRecords": 2399
},
"elements": [
{
"productId": "000820",
"internalRef": "000820",
"name": "red cotton shirt,",
"brand": "Clothes & Co",
"brandTypology": "NO NAME",
"isEnable": true,
"status": "ACTIVE",
"statusLabel": "Active",
"saleUnit": "ITEM",
"unitaryWeightVolume": {
"amount": 0,
"unit": "PIECE"
},
"infosFeLs": null,
"imagesUrls": null,
"eanMain": "07490201245",
"eans": [
"0442301152930",
"000042",
"00000512",
"5000000000105",
"00000492",
"2000000000492",
"00000901",
"2000000000901",
"00000328",
"2000000000176",
"00000345",
"2000000000343",
"00000352",
"2000000000350",
"00000234",
"2000000000367",
"00000242",
"2000000000244",
"00000081",
"2000000000381",
"00000908",
"2000000000398"
],
"nomenclatures": [
{
"nomenclatureId": "0001-0001-0028-0010",
"type": "CL",
"name": "Clothing",
"level1": "",
"level2": null,
"level3": null,
"level4": null,
"level5": null,
"updateDateTime": null
}
],
"compositeProduct": null,
"updateDateTime": "2024-06-12T12:02:39.556Z",
"numeroPresence": "",
"moduleName": "EF Branding",
"fournisseurCode": "000127",
"fournisseurName": "eFashion",
"imageMain": "",
"inactive": false,
"language": "fr-fr",
"isBio": "No",
"isEcoCert": "Yes"
}
]
}
Retry
The API needs to match some conditions for the call to be considered successful, and it might need more than one retry.
Parameter | Description |
---|---|
Retry count | Maximum number of retries to be made |
Retry interval(s) | In seconds, interval between retries |
Expected status | Returned HTTP status considered as a success, usually 200 |
Condition attribute | Attribute that needs to match a value in order for the call to be considered successfulExample: object.status |
Value to match | Value that needs to match the attribute for the call to be considered successful |
Example
- Maximum number of attempts:
10
- Interval between each request:
30
- Expected HTTP response:
200
- Property that conditions the attempts:
statusFile
- Expected value to stop the attempts:
AVAILABLE
When the job starts, the calls continue and are retried until the AVAILABLE
status is returned.
Example: Call 1
{
"invocationId": "799be90d-5528-4f8b-a651-687e73a7ce8e",
"statusFile": "PENDING",
"urlFile": ""
}
Example: Call 2
{
"invocationId": "799be90d-5528-4f8b-a651-687e73a7ce8e",
"statusFile": "AVAILABLE",
"urlFile": "https://{fileURL}"
}
Job frequency
Each API request can be configured to automatically run as specific times:
Frequency | Options |
---|---|
Minutes | Every X minutes |
Hourly | Every X hour and X minutes Or a specific hour |
Daily | Every X days at a specific hour Or every weekday at a specific hour |
Weekly | Tick the day(s) for the job to run at a specific hour |
Monthly | Day X of every month Or last day of the month Or last weekday of every month At a specifihour |
Custom | Use cron (opens new window) to schedule jobs. |
Path variables
If the call URL template contains a {variable}
in curly braces, an input appears with the value to add for the variable. This value can be either a consistent or dynamic value:
- When the dynamic value starts with
$.
, the previous call reponse's value is fetched. - When the dynamic value ends with
({parameters})
, a built-in function is called. List of current durations built in:lastJobExecutionMinusDuration(<duration>)
. Duration is of the form of ISO_8601.
Query parameters
Query parameters are a defined set of parameters (key-value pair) attached to
the end of a URL used to provide additional information to a web server when
making requests. The final URL is generated with those values
(?var=value&var2=value2
).