Skip to content

Collections

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.

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"];
};
GET http://localhost:7292/dstapi/DSTV1/GetAllCollections
{
"Success": true,
"Collections": [
{
"Id": 1,
"Name": "My Collection",
"Description": "My description goes here...",
"CollectionLive": true,
"IsDefault": false
},
...
]
}
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;
};
GET http://localhost:7292/dstapi/DSTV1/GetCollection/{id}

id: ID of the collection

{
"Success": true,
"Collection": {
"Id": 1,
"Name": "My Collection",
"Description": "My description goes here...",
"CollectionLive": true,
"IsDefault": false
}
}
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;
};
GET http://localhost:7292/dstapi/DSTV1/DeleteCollection/{id}

id: ID of the collection

{
"Success": true
}
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;
};