datakick
Module for making requests to the Datakick API
Installation
npm
npm install datakick --save
unpkg
<script src="https://unpkg.com/datakick@1.2.0/dist/datakick.min.js"></script>
Usage
const datakick = require ( ' datakick ' ) ;
datakick . item ( ' 4335896051932 ' ) . then ( data => {
console . log ( JSON . stringify ( data ) ) ;
} ) . catch ( error => {
console . log ( error . message ) ;
} ) ;
Features
Get an item by its GTIN
datakick . item ( ' 4335896051932 ' ) . then ( data => {
console . log ( JSON . stringify ( data ) ) ;
} ) . catch ( error => {
console . log ( error . message ) ;
} ) ;
Update an existing item
datakick . update ( ' 000000000000 ' , {
name : ' Test ' ,
brand_name : ' Test Brand '
} ) . then ( data => {
console . log ( JSON . stringify ( data ) ) ;
} ) . catch ( error => {
console . log ( error . message ) ;
} ) ;
Add a new item
datakick . add ( ' 000000000000 ' , {
name : ' Test ' ,
brand_name : ' Test Brand '
} ) . then ( data => {
console . log ( JSON . stringify ( data ) ) ;
} ) . catch ( error => {
console . log ( error . message ) ;
} ) ;
List the first 100 products
datakick . list ( ) . then ( data => {
console . log ( JSON . stringify ( data ) ) ;
} ) . catch ( error => {
console . log ( error . message ) ;
} ) ;
List all items of a specific page
datakick . page ( ' 20 ' ) . then ( data => {
console . log ( JSON . stringify ( data ) ) ;
} ) . catch ( error => {
console . log ( error . message ) ;
} ) ;
Search for items
datakick . query ( ' peanut butter ' ) . then ( data => {
console . log ( JSON . stringify ( data ) ) ;
} ) . catch ( error => {
console . log ( error . message ) ;
} ) ;
Upload an image
datakick . image ( ' 000000000000 ' , ' image.jpg ' ) . then ( data => {
console . log ( JSON . stringify ( data ) ) ;
} ) . catch ( error => {
console . log ( error . message ) ;
} ) ;
License
GPL-3.0