Add a synonym
const url = 'https://api.shoofai.com/v1/apps/demo-store/synonyms';const options = { method: 'POST', headers: { 'Idempotency-Key': '4f1c2a9e-7b1d-4c0e-9a51-2d3f6b8e0c47', 'x-shoof-api-key': '<x-shoof-api-key>', 'Content-Type': 'application/json' }, body: '{"terms":["sofa","couch","settee"]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.shoofai.com/v1/apps/demo-store/synonyms \ --header 'Content-Type: application/json' \ --header 'Idempotency-Key: 4f1c2a9e-7b1d-4c0e-9a51-2d3f6b8e0c47' \ --header 'x-shoof-api-key: <x-shoof-api-key>' \ --data '{ "terms": [ "sofa", "couch", "settee" ] }'Adds one synonym. The body is the synonym, or {"synonym": {...}}. The response has its id.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The app’s id, shown in the dashboard (for example ali-sport-goods). demo-store is the public demo app.
Example
demo-storeHeader Parameters
Section titled “Header Parameters”A unique value, such as a UUID, that makes retrying this request safe. The first request
with a key runs; for 24 hours a retry with the same key and the same body gets the first
response again, with Idempotent-Replayed: true, and doesn’t run a second time. The same
key with a different body is refused (409 idempotency_key_reused), and so is a retry
while the first request is still running (409 idempotency_key_in_use). Keys belong to
the app. Only successful responses are kept: after an error the key is free again.
Example
4f1c2a9e-7b1d-4c0e-9a51-2d3f6b8e0c47Request Bodyrequired
Section titled “Request Bodyrequired”object
synonym: the terms all match each other. oneway: input also finds the terms, not the reverse.
The word that also finds the terms (oneway only).
At least two for a synonym.
Example
{ "terms": [ "sofa", "couch", "settee" ]}Responses
Section titled “Responses”The saved synonym, with its id.
object
object
synonym: the terms all match each other. oneway: input also finds the terms, not the reverse.
The word that also finds the terms (oneway only).
At least two for a synonym.
Example
{ "synonym": { "kind": "synonym" }}The request is invalid (bad_request). details lists each problem with its path.
object
object
A stable, machine-readable code.
A human-readable explanation.
More about the error, such as the validation problems.
Example
{ "error": { "code": "bad_request", "message": "Invalid request", "details": [ { "path": "hitsPerPage", "message": "Must be 100 or less" } ] }}The month’s quota and the workspace’s prepaid balance are both used up, or the plan’s
limit is reached (quota_exceeded). Every plan has hard limits; nothing is served first
and billed later. Buying a pack in Billing adds to the balance.
object
object
A stable, machine-readable code.
A human-readable explanation.
More about the error, such as the validation problems.
Example generated
{ "error": { "code": "example", "message": "example", "details": "example" }}The Idempotency-Key was used for a different request (idempotency_key_reused), or the
first request with it is still running (idempotency_key_in_use).
object
object
A stable, machine-readable code.
A human-readable explanation.
More about the error, such as the validation problems.
Example generated
{ "error": { "code": "example", "message": "example", "details": "example" }}Too many requests in this window (rate_limited). Wait Retry-After seconds, then retry.
object
object
A stable, machine-readable code.
A human-readable explanation.
More about the error, such as the validation problems.
Example
{ "error": { "code": "rate_limited", "message": "Rate limit exceeded" }}Headers
Section titled “Headers”Seconds to wait before retrying. Sent with every 429.
What’s left in the window (IETF draft-ietf-httpapi-ratelimit-headers): the bucket’s name,
r the requests left and t the seconds until the window resets. Sent on every response.
Example
"search";r=597;t=43The bucket’s quota q per window of w seconds. Sent on every response.
Example
"search";q=600;w=60The requests allowed per window (the older form of RateLimit-Policy).
The requests left in the window.
Seconds until the window resets.