Skip to content

Latest commit

 

History

History
298 lines (208 loc) · 8.74 KB

File metadata and controls

298 lines (208 loc) · 8.74 KB

SwappyRestApi.DataApi

All URIs are relative to https://api.swappy.com/

Method HTTP request Description
getCategories GET /v1/categories
getCategory GET /v1/categories/{id}
getDurations GET /v1/durations
getOptions GET /v1/options
getShippingMethods GET /v1/shippingmethods

getCategories

[Category] getCategories(opts)

Get all categories from the website

Example

var SwappyRestApi = require('swappy_rest_api');
var defaultClient = SwappyRestApi.ApiClient.default;

// Configure OAuth2 access token for authorization: oauth
var oauth = defaultClient.authentications['oauth'];
oauth.accessToken = 'YOUR ACCESS TOKEN';

var apiInstance = new SwappyRestApi.DataApi();

var opts = { 
  'depth': 56, // Integer | Number sublevels wanted, `1` for top level only. **default:** no limit
  'ifNoneMatch': "ifNoneMatch_example", // String | Etag, will return `304 Not Modified` if content hasn't changed
  'ifModifiedSince': new Date("2013-10-20T19:20:30+01:00"), // Date | Will return `304 Not Modified` if content hasn't changed
  'language': "language_example" // String | Language for the response
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.getCategories(opts, callback);

Parameters

Name Type Description Notes
depth Integer Number sublevels wanted, `1` for top level only. default: no limit [optional]
ifNoneMatch String Etag, will return `304 Not Modified` if content hasn't changed [optional]
ifModifiedSince Date Will return `304 Not Modified` if content hasn't changed [optional]
language String Language for the response [optional]

Return type

[Category]

Authorization

oauth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

getCategory

Category getCategory(id, opts)

Get one category categories from the website

Example

var SwappyRestApi = require('swappy_rest_api');
var defaultClient = SwappyRestApi.ApiClient.default;

// Configure OAuth2 access token for authorization: oauth
var oauth = defaultClient.authentications['oauth'];
oauth.accessToken = 'YOUR ACCESS TOKEN';

var apiInstance = new SwappyRestApi.DataApi();

var id = 56; // Integer | Product ID

var opts = { 
  'ifNoneMatch': "ifNoneMatch_example", // String | Etag, will return `304 Not Modified` if content hasn't changed
  'ifModifiedSince': new Date("2013-10-20T19:20:30+01:00"), // Date | Will return `304 Not Modified` if content hasn't changed
  'language': "language_example" // String | Language for the response
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.getCategory(id, opts, callback);

Parameters

Name Type Description Notes
id Integer Product ID
ifNoneMatch String Etag, will return `304 Not Modified` if content hasn't changed [optional]
ifModifiedSince Date Will return `304 Not Modified` if content hasn't changed [optional]
language String Language for the response [optional]

Return type

Category

Authorization

oauth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

getDurations

InlineResponse200 getDurations(opts)

Get available durations

Example

var SwappyRestApi = require('swappy_rest_api');
var defaultClient = SwappyRestApi.ApiClient.default;

// Configure OAuth2 access token for authorization: oauth
var oauth = defaultClient.authentications['oauth'];
oauth.accessToken = 'YOUR ACCESS TOKEN';

var apiInstance = new SwappyRestApi.DataApi();

var opts = { 
  'ifNoneMatch': "ifNoneMatch_example", // String | Etag, will return `304 Not Modified` if content hasn't changed
  'ifModifiedSince': new Date("2013-10-20T19:20:30+01:00"), // Date | Will return `304 Not Modified` if content hasn't changed
  'language': "language_example" // String | Language for the response
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.getDurations(opts, callback);

Parameters

Name Type Description Notes
ifNoneMatch String Etag, will return `304 Not Modified` if content hasn't changed [optional]
ifModifiedSince Date Will return `304 Not Modified` if content hasn't changed [optional]
language String Language for the response [optional]

Return type

InlineResponse200

Authorization

oauth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

getOptions

[Option] getOptions(opts)

Get paying options for a product

Example

var SwappyRestApi = require('swappy_rest_api');
var defaultClient = SwappyRestApi.ApiClient.default;

// Configure OAuth2 access token for authorization: oauth
var oauth = defaultClient.authentications['oauth'];
oauth.accessToken = 'YOUR ACCESS TOKEN';

var apiInstance = new SwappyRestApi.DataApi();

var opts = { 
  'ifNoneMatch': "ifNoneMatch_example", // String | Etag, will return `304 Not Modified` if content hasn't changed
  'ifModifiedSince': new Date("2013-10-20T19:20:30+01:00"), // Date | Will return `304 Not Modified` if content hasn't changed
  'language': "language_example" // String | Language for the response
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.getOptions(opts, callback);

Parameters

Name Type Description Notes
ifNoneMatch String Etag, will return `304 Not Modified` if content hasn't changed [optional]
ifModifiedSince Date Will return `304 Not Modified` if content hasn't changed [optional]
language String Language for the response [optional]

Return type

[Option]

Authorization

oauth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

getShippingMethods

[ShippingMethod] getShippingMethods(opts)

Get all shipping methods

Example

var SwappyRestApi = require('swappy_rest_api');
var defaultClient = SwappyRestApi.ApiClient.default;

// Configure OAuth2 access token for authorization: oauth
var oauth = defaultClient.authentications['oauth'];
oauth.accessToken = 'YOUR ACCESS TOKEN';

var apiInstance = new SwappyRestApi.DataApi();

var opts = { 
  'ifNoneMatch': "ifNoneMatch_example", // String | Etag, will return `304 Not Modified` if content hasn't changed
  'ifModifiedSince': new Date("2013-10-20T19:20:30+01:00"), // Date | Will return `304 Not Modified` if content hasn't changed
  'language': "language_example" // String | Language for the response
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
apiInstance.getShippingMethods(opts, callback);

Parameters

Name Type Description Notes
ifNoneMatch String Etag, will return `304 Not Modified` if content hasn't changed [optional]
ifModifiedSince Date Will return `304 Not Modified` if content hasn't changed [optional]
language String Language for the response [optional]

Return type

[ShippingMethod]

Authorization

oauth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json