Skip to main content

Collections

Create / Update Collection

API Enpoint:

POST http://localhost:7292/dstapi/DSTV1/SaveCollection

Params:

{
"Id": 0,
"Name": "My Collection",
"Description": "My description goes here...",
"CollectionLive": true,
"IsDefault": false
}

Use ID of 0 if it's a new collection. For updating, use the existing ID of that collection.

Code Example

const saveCollection = async (id = 0) => {
const payload = {
Id: id,
Name: "My Collection",
Description: "My description goes here...",
CollectionLive: true,
IsDefault: false,
};

const url = `${CLI_BASE_URL}/dstapi/DSTV1/SaveCollection`;
const request = await fetch(url, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(payload),
});

const data = await request.json();

return data["Success"];
};

List Collections

API Enpoint:

GET http://localhost:7292/dstapi/DSTV1/GetAllCollections

Response:

{
"Success": true,
"Collections": [
{
"Id": 1,
"Name": "My Collection",
"Description": "My description goes here...",
"CollectionLive": true,
"IsDefault": false
},
...
]
}

Code Example

const listCollections = async () => {
const url = `${CLI_BASE_URL}/dstapi/DSTV1/GetAllCollections`;
const request = await fetch(url);

const data = await request.json();

if (!data) {
return null;
}

if (data["Success"] == true) {
return data["Collections"];
}

return null;
};

Retrieve Collection

API Enpoint:

GET http://localhost:7292/dstapi/DSTV1/GetCollection/{id}

URL Params:

id: ID of the collection

Response:

{
"Success": true,
"Collection": {
"Id": 1,
"Name": "My Collection",
"Description": "My description goes here...",
"CollectionLive": true,
"IsDefault": false
}
}

Code Example

const retrieveCollection = async (collectionId) => {
const url = `${CLI_BASE_URL}/dstapi/DSTV1/GetCollection/${collectionId}`;
const request = await fetch(url);

const data = await request.json();

if (!data) {
return null;
}

if (data["Success"] == true) {
return data["Collection"];
}

return null;
};

Delete Collection

API Enpoint:

GET http://localhost:7292/dstapi/DSTV1/DeleteCollection/{id}

URL Params:

id: ID of the collection

Response:

{
"Success": true
}

Code Example

const deleteCollection = async (collectionId) => {
const url = `${CLI_BASE_URL}/dstapi/DSTV1/DeleteCollection/${collectionId}`;
const request = await fetch(url);

const data = await request.json();

return data["Success"] == true;
};