Dalevex for Ecwid API Documentation

All responses are in JSON format.

ping

Meant to test connection and auth tokens.

Example (curl in bash)

$ curl "https://ecwid.dalevex.com/api/ping?debug=true&store-id=12345678" -H "Authorization: secret_abcdefghijklmnopqrstuv1234567890"
{"message": "Pong!", "debug": true, "store-id": "12345678", "store-id-allowed": true, "auth": "secret_abcdefghijklmnopqrstuv1234567890", "auth-check": {"status-code": 200, "is-secret-key": true}}

Example (python)

>>> import requests
>>> x = requests.get('https://ecwid.dalevex.com/api/ping?debug=true&store-id=12345678', headers={'Authorization': 'secret_abcdefghijklmnopqrstuv1234567890'})
>>> x.json()
{'message': 'Pong!', 'debug': True, 'store-id': '12345678', 'store-id-allowed': True, 'auth': 'secret_abcdefghijklmnopqrstuv1234567890', 'auth-check': {'status-code': 200, 'is-secret-key': True}}

Response status codes

StatusInfo
200Should always return this.

Response JSON

Will always be included in response:

KeyTypesInfo
messagestringAlways "Pong!"
debugbooleantrue if URL query includes "debug=true", otherwise false.

Will only be included if debug is true:

KeyTypesInfo
store-idnull, stringStore ID given in URL query.
store-id-allowedbooleanWhether the given store ID is allowed to use the Dalevex API.
authnull, stringAccess token given in Authorization header.
auth-checknull, object null if either store-id or auth are null, or if store-id-allowed is false. Otherwise:
KeyTypesInfo
status-codenumberThe status code returned from Ecwid.
is-secret-keynull, booleanWhether auth is a secret key or not, if it can be determined.

Authorization-required requests

For the API requests below this, the given store ID and auth token will be checked. If there is something wrong with the store ID and auth token, these responses will be returned and nothing will happen.

Response status codes

StatusInfo
400No store ID provided, or there was an unknown problem connecting to the Ecwid API.
403The provided store ID is not allowed to use the Dalevex API, no authorization header provided, or authorization header is invalid.

Response JSON

Will always be included in response:

KeyTypesInfo
messagestring Depending on what went wrong, the message may be any of the following:
  • No store ID provided.
  • No authorization header provided.
  • This Store ID is not allowed to use this API.
  • Invalid authorization header.
  • Something went wrong when connecting to Ecwid API.

If something went wrong, but the reason could not be determined:

KeyTypesInfo
messagestringAlways "Something went wrong when connecting to Ecwid API."
status-code-ecwidnumberStatus code from Ecwid API.

update-database

Updates Dalevex's internal product database.

Example (curl in bash)

$ curl "https://ecwid.dalevex.com/api/update-database?store-id=12345678" -H "Authorization: secret_abcdefghijklmnopqrstuv1234567890"
{"success": 49, "failure": 0}

Example (python)

>>> import requests
>>> x = requests.get('https://ecwid.dalevex.com/api/update-database?store-id=12345678', headers={'Authorization': 'secret_abcdefghijklmnopqrstuv1234567890'})
>>> x.json()
{'success': 49, 'failure': 0}

Response status codes

StatusInfo
200The database was successfully updated.
409The store is either currently busy updating, or exceeds 50000 products.
400Something went wrong when connecting to the Ecwid API.

Response JSON

Will only be included for a 200 status code:

KeyTypesInfo
successnumberThe amount of products that were successfully updated.
failurenumberThe amount of products that failed to update.

Will only be included for a 409 status code:

KeyTypesInfo
messagestringAlways "Store is either busy updating, or exceeds 50000 products. Please try again later."

Will only be included for a 400 status code:

KeyTypesInfo
messagestringAlways "Error while connecting to Ecwid API."
statusnumberStatus code from Ecwid API.

search

Searches the internal product database using process.extract() and fuzz.token_set_ratio() from the thefuzz python package.
Limit is 100 by default, and must be a number between (inclusive) 0 and 100. The example below use limit=1 because otherwise it would take up a lot of space and I don't want to try to make up 100 fake products.
You can also use offset for paging.
A null "stock" means unlimited, otherwise stock will be a number.

Example (curl in bash)

$ curl "https://ecwid.dalevex.com/api/search?store-id=12345678&query=test&limit=1&offset=0" -H "Authorization: secret_abcdefghijklmnopqrstuv1234567890"
{"store-id": "12345678", "query": "test", "limit": 1, "offset": 0, "total": 52, "is-secret-key": true, "results": [{"score": 100, "product-id": 12345678, "sku": "00001", "name": "Test Product", "image-url": "https://example.com/images/test-product.webp", "updated-time": "2024-01-01T00:00:00Z", "updated-timestamp": 1704067200.0, "enabled": true, "stock": 12, "price": "4.990000", "upc": "0123456789"}]}

Example (python)

>>> import requests
>>> x = requests.get('https://ecwid.dalevex.com/api/search?store-id=12345678&query=test&limit=1&offset=0', headers={'Authorization': 'secret_abcdefghijklmnopqrstuv1234567890'})
>>> x.json()
{'store-id': '12345678', 'query': 'test', 'limit': 1, 'offset': 0, 'total': 52, 'is-secret-key': True, 'results': [{'score': 100, 'product-id': 12345678, 'sku': '00001', 'name': 'Test Product', 'image-url': 'https://example.com/images/test-product.webp', 'updated-time': '2024-01-01T00:00:00Z', 'updated-timestamp': 1704067200.0, 'enabled': True, 'stock': 12, 'price': '4.990000', 'upc': '0123456789'}]}

Response status codes

StatusInfo
200The search was successfully completed.
409The store is either currently busy updating.
400No search query provided.

Response JSON

Will only be included for a 200 status code:

KeyTypesInfo
store-idstringStore ID given in URL query.
querystringSearch query given in URL query.
limitnumberLimit given in URL query
offsetnumberOffset give n in URL query
totalnumberThe total amount of products in the store. Does not include disabled products if is-secret-key is not true.
is-secret-keynull, booleanWhether auth is a secret key or not, if it can be determined.
resultsarray Search results, contains an array of objects:
KeyTypesInfo
scorenumberSearch score from 100 (very close to query) to 0 (not similar to query at all)
product-idnumberProduct's Ecwid product ID.
skustringProduct's SKU.
namestringProduct's name.
image-urlstringURL for product's main image.
updated-timestringProduct's last modified time.
updated-timestampnumberProduct's last modified timestamp.
enabledbooleanWhether the product is enabled or not.
stocknull, numberProduct's stock. Will be null if stock is unlimited.
pricestringProduct's price to 6 decimals, including leading zeros.
upcstringProduct's UPC.

Will only be included for a 409 status code:

KeyTypesInfo
messagestringAlways "Store is currently busy updating. Please try again later.'"

Will only be included for a 400 status code:

KeyTypesInfo
messagestringAlways "No search query."