Skip to content

Examples of all endpoints

David Gonzalez edited this page Jun 14, 2017 · 1 revision

Below is a full list of endpoint usage examples. Note that these could also use async/await.

PRODUCTS

  • retrieve product -- GET /products/:id
vhx.products.retrieve(1233).then((res) => { console.log(res) });
vhx.products.retrieve('http://api.crystal.dev/products/1234').then((res) => { console.log(res) });
  • list all products -- GET /products vhx.products.all().then((res) => { console.log(res) });

BROWSE

  • list all items GET /browse/:product_id vhx.browse.list({product: 14440});

VIDEOS

  • retrieve video -- GET /videos/:id
vhx.videos.retrieve(1234).then((res) => { console.log(res) });
vhx.videos.retrieve('http://api.crystal.dev/videos/1234').then((res) => { console.log(res) });
  • list all videos GET /videos vhx.videos.all().then((res) => { console.log(res) });

  • list all files GET /videos/:id/files

vhx.videos.files(1).then((res) => { console.log(res) });
vhx.videos.files('http://api.crystal.dev/videos/1').then((res) => { console.log(res) });

COLLECTIONS

  • retrieve collection GET /collections/:id
vhx.collections.retrieve(1).then((res) => { console.log(res) });
vhx.collections.retrieve('http://api.crystal.dev/collections/1').then((res) => { console.log(res) });
  • list all collections GET /collections vhx.collections.all().then((res) => { console.log(res) });

  • list all items GET /collections/:id/items

vhx.collections.items(1).then((res) => { console.log(res) });
vhx.collections.items('http://api.crystal.dev/collections/1').then((res) => { console.log(res) });

CUSTOMERS

  • retrieve customer -- GET /customers/:id
vhx.customers.retrieve(1).then((res) => { console.log(res) });
vhx.customers.retrieve('http://api.crystal.dev/customers/1').then((res) => { console.log(res) });
  • list all customers -- GET /customers vhx.customers.all();

  • retrieve watching items -- GET /customers/:id/watching

vhx.customers.watching(1).then((res) => { console.log(res) });
vhx.customers.watching('http://api.crystal.dev/customers/1').then((res) => { console.log(res) });
  • retrieve watchlist items -- GET /customers/:id/watchlist
vhx.customers.watchlist(1).then((res) => { console.log(res) });
vhx.customers.watchlist('http://api.crystal.dev/customers/1').then((res) => { console.log(res) });

ANALYTICS

  • retrieve report GET /analytics -- param: type ->traffic, income_statement, units, subscribers, churn, video, video.platform, video.geography, video.subtitles
vhx.analytics.retrieve({ type: "traffic" }).then((res) => { console.log(res) });
vhx.analytics.retrieve({ type: "units" }).then((res) => { console.log(res) });
Clone this wiki locally