Collections
Esta página aún no está disponible en tu idioma.
Create / Update Collection
Section titled “Create / Update Collection”API Enpoint:
Section titled “API Enpoint:”POST http://localhost:7292/dstapi/DSTV1/SaveCollectionParams:
{ "Id": 0, "Name": "My Collection", "Description": "My description goes here...", "CollectionLive": true, "IsDefault": false}Use ID of
0if it’s a new collection. For updating, use the existing ID of that collection.
Code Example
Section titled “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"];};def save_collection(id=0): payload = { "Id": id, "Name": "My Collection", "Description": "My description goes here...", "CollectionLive": True, "IsDefault": False }
url = f"{CLI_BASE_URL}/dstapi/DSTV1/SaveCollection" headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers) data = response.json()
return data["Success"]List Collections
Section titled “List Collections”API Enpoint:
Section titled “API Enpoint:”GET http://localhost:7292/dstapi/DSTV1/GetAllCollectionsResponse:
Section titled “Response:”{ "Success": true, "Collections": [ { "Id": 1, "Name": "My Collection", "Description": "My description goes here...", "CollectionLive": true, "IsDefault": false }, ... ]}Code Example
Section titled “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;};def list_collections(): url = f"{CLI_BASE_URL}/dstapi/DSTV1/GetAllCollections" response = requests.get(url) data = response.json()
if not data: return None
if data["Success"] == True: return data["Collections"]
return NoneRetrieve Collection
Section titled “Retrieve Collection”API Enpoint:
Section titled “API Enpoint:”GET http://localhost:7292/dstapi/DSTV1/GetCollection/{id}URL Params:
Section titled “URL Params:”id: ID of the collection
Response:
Section titled “Response:”{ "Success": true, "Collection": { "Id": 1, "Name": "My Collection", "Description": "My description goes here...", "CollectionLive": true, "IsDefault": false }}Code Example
Section titled “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;};def retrieve_collection(collection_id): url = f"{CLI_BASE_URL}/dstapi/DSTV1/GetCollection/{collection_id}" response = requests.get(url) data = response.json()
if not data: return None
if data["Success"] == True: return data["Collection"]
return NoneDelete Collection
Section titled “Delete Collection”API Enpoint:
Section titled “API Enpoint:”GET http://localhost:7292/dstapi/DSTV1/DeleteCollection/{id}URL Params:
Section titled “URL Params:”id: ID of the collection
Response:
Section titled “Response:”{ "Success": true}Code Example
Section titled “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;};def delete_collection(collection_id): url = f"{CLI_BASE_URL}/dstapi/DSTV1/DeleteCollection/{collection_id}" response = requests.get(url) data = response.json()
return data["Success"] == True