Skip to main content

Client code examples

Client applications communicate with a Codehooks API and database via a secure REST API. You can interface with Codehooks from most popular programming languages and platforms, such as: cURL, JavaScript, Python, PHP, Java, C#, Kotlin, R and Swift.

In the code examples shown below we use mystore-fafb as an example Codehooks project name and dev as a project data space. Replace this with your own project name, and use a valid API token (x-apikey) or a JWT/JWKS integration (Bearer <token>).

GET documents from the salesorder collection.

curl --location 'https://mystore-fafb.api.codehooks.io/dev/salesorder?customerID=1234' \
--header 'x-apikey: 3c932310-3fab-4ba3-8102-b75ba0f05149'

POST a new document to the salesorder collection.

curl --location 'https://mystore-fafb.api.codehooks.io/dev/salesorder' \
--header 'x-apikey: 3c932310-3fab-4ba3-8102-b75ba0f05149' \
--header 'Content-Type: application/json' \
--data '{
"customerID": 1234,
"productID": 21435465,
"quantity": 3,
"payment": "subscription"
}'

PATCH (update) an existing document in the salesorder collection.

curl --location --request PATCH 'https://mystore-fafb.api.codehooks.io/dev/salesorder/9876' \
--header 'x-apikey: 3c932310-3fab-4ba3-8102-b75ba0f05149' \
--header 'Content-Type: application/json' \
--data '{
"quantity": 2,
"payment": "card"
}'

DELETE a document in the salesorder collection.

curl --location --request DELETE 'https://mystore-fafb.api.codehooks.io/dev/salesorder/9876' \
--header 'x-apikey: 3c932310-3fab-4ba3-8102-b75ba0f05149'