API
Metadata API
Using this API you are able to store metadata against customers. This metadata can then be used as a filter in the Data Explorer. It will also be shown on the customers page.
Be careful with what data you send, make sure it is nothing sensitive.
View all metadata
This endpoint allows you to retrieve a paginated list of all your collaborators.
Optional attributes
per_page
– the number of results returned, defaults to 15. Max 100 per page.page
– page number, defaults to page 1.
Example Request
GET /api/public/metadata
curl -G https://saasinsights.com/api/public/metadata \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H "Authorization: Bearer {token}" \
-d page=1 \
-d per_page=50
Example Response
{
"data": [
{
"id": "01955eb7-7028-9f6b-7a82-4141a651a978",
"key": "type",
"value": "VIP",
"app": {
"id": "01953c7d-3525-c982-1234-ea14c069fd7d",
"name": "Demo App",
"shopify_id": "123"
},
"account": {
"id": "01953c7a-1234-c849-8c74-e40286527dd2",
"name": "Demo Account"
},
"customer": {
"id": "018c56ee-6587-0868-c7c2-17b4c979d01b",
"shopify_id": "60063809729",
"name": "Test Store 442i349083048",
"domain": "test-store-442i349083048.myshopify.com",
"url": "https://saasinsights.app/customers/018c56ee-6587-0868-c7c2-17b4c979d01b"
}
}
],
"links": {
"first": "https://saasinsights.app/api/public/metadata?page=1",
"last": "https://saasinsights.app/api/public/metadata?page=1",
"prev": null,
"next": null
},
"meta": {
"current_page": 1,
"from": 1,
"last_page": 1,
"path": "https://saasinsights.app/api/public/metadata",
"per_page": 50,
"to": 1,
"total": 1
}
}
Create new metadata
This endpoint allows you to create a new metadata for a customer.
Required Parameters
- customerId – Shop ID for this customer
Required Attributes
- key – identifier for the data
- value – metadata value
- app_id – ID of the app this is for (this is the Shopify app ID)
Example Request
POST /api/public/metadata/{customerId}
curl -G -X POST https://saasinsights.com/api/public/metadata/60063809729 \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H "Authorization: Bearer {token}" \
-d key=type \
-d value=VIP \
-d app_id=123
Example Response
{
"data": {
"id": "01955eb7-7028-9f6b-7a82-4141a651a978",
"key": "type",
"value": "VIP",
"app": {
"id": "01953c7d-3525-c982-1234-ea14c069fd7d",
"name": "Demo App",
"shopify_id": "123"
},
"account": {
"id": "01953c7a-1234-c849-8c74-e40286527dd2",
"name": "Demo Account"
},
"customer": {
"id": "018c56ee-6587-0868-c7c2-17b4c979d01b",
"shopify_id": "60063809729",
"name": "Test Store 442i349083048",
"domain": "test-store-442i349083048.myshopify.com",
"url": "https://saasinsights.app/customers/018c56ee-6587-0868-c7c2-17b4c979d01b"
}
}
}
View metadata
This endpoint allows you view metadata that has already been created.
Required Parameters
- metadataId – ID returned when creating the metadata
Example Request
GET /api/public/metadata/{metadataId}
curl -G https://saasinsights.com/api/public/metadata/01955eb7-7028-9f6b-7a82-4141a651a978 \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H "Authorization: Bearer {token}"
Example Response
{
"data": {
"id": "01955eb7-7028-9f6b-7a82-4141a651a978",
"key": "type",
"value": "Standard",
"app": {
"id": "01953c7d-3525-c982-1234-ea14c069fd7d",
"name": "Demo App",
"shopify_id": "123"
},
"account": {
"id": "01953c7a-1234-c849-8c74-e40286527dd2",
"name": "Demo Account"
},
"customer": {
"id": "018c56ee-6587-0868-c7c2-17b4c979d01b",
"shopify_id": "60063809729",
"name": "Test Store 442i349083048",
"domain": "test-store-442i349083048.myshopify.com",
"url": "https://saasinsights.app/customers/018c56ee-6587-0868-c7c2-17b4c979d01b"
}
}
}
Update metadata
This endpoint allows you to update metadata you have already created.
Required Parameters
- metadataId – ID returned when creating the metadata
Required Attributes
- key – identifier for the data
- value – metadata value
- app_id – ID of the app this is for (this is the Shopify app ID)
Example Request
PUT /api/public/metadata/{metadataId}
curl -G -X PUT https://saasinsights.com/api/public/metadata/01955eb7-7028-9f6b-7a82-4141a651a978 \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H "Authorization: Bearer {token}" \
-d key=type \
-d value=Standard \
-d app_id=123
Example Response
{
"data": {
"id": "01955eb7-7028-9f6b-7a82-4141a651a978",
"key": "type",
"value": "Standard",
"app": {
"id": "01953c7d-3525-c982-1234-ea14c069fd7d",
"name": "Demo App",
"shopify_id": "123"
},
"account": {
"id": "01953c7a-1234-c849-8c74-e40286527dd2",
"name": "Demo Account"
},
"customer": {
"id": "018c56ee-6587-0868-c7c2-17b4c979d01b",
"shopify_id": "60063809729",
"name": "Test Store 442i349083048",
"domain": "test-store-442i349083048.myshopify.com",
"url": "https://saasinsights.app/customers/018c56ee-6587-0868-c7c2-17b4c979d01b"
}
}
}
Delete metadata
This endpoint delete any metadata.
Required Parameters
- metadataId – ID returned when creating the metadata
Example Request
DELETE /api/public/metadata/{metadataId}
curl -G -X DELETE https://saasinsights.com/api/public/metadata/01955eb7-7028-9f6b-7a82-4141a651a978 \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H "Authorization: Bearer {token}"