All URIs are relative to https://api.swappy.com/
| Method | HTTP request | Description |
|---|---|---|
| createProduct | POST /v1/products | |
| endProduct | DELETE /v1/products/{id} | |
| getProduct | GET /v1/products/{id} | |
| updateProduct | PATCH /v1/products/{id} | |
| uploadPicture | POST /v1/pictures |
Product createProduct(body, opts)
Submit a new product to your account
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.ProductsApi();
var body = new SwappyRestApi.Product(); // Product | Product object that will be added to the store
var opts = {
'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.createProduct(body, opts, callback);| Name | Type | Description | Notes |
|---|---|---|---|
| body | Product | Product object that will be added to the store | |
| language | String | Language for the response | [optional] |
- Content-Type: application/json
- Accept: application/json
Product endProduct(id)
End a product before it's normal end date
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.ProductsApi();
var id = 56; // Integer | Product ID
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
apiInstance.endProduct(id, callback);| Name | Type | Description | Notes |
|---|---|---|---|
| id | Integer | Product ID |
- Content-Type: application/json
- Accept: application/json
ShortProduct getProduct(id, opts)
Get a specific product by ID
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.ProductsApi();
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.getProduct(id, opts, callback);| 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] |
- Content-Type: application/json
- Accept: application/json
Product updateProduct(id, body)
Edit an existing product
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.ProductsApi();
var id = 56; // Integer | Product ID
var body = new SwappyRestApi.Product(); // Product | Informations that you are editing, images will be added
var callback = function(error, data, response) {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
};
apiInstance.updateProduct(id, body, callback);| Name | Type | Description | Notes |
|---|---|---|---|
| id | Integer | Product ID | |
| body | Product | Informations that you are editing, images will be added |
- Content-Type: application/json
- Accept: application/json
[TempImage] uploadPicture(files, opts)
Upload images Images will be deleted after 30 days if not used in a product.
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.ProductsApi();
var files = "/path/to/file.txt"; // File | The images, can be an array
var opts = {
'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.uploadPicture(files, opts, callback);| Name | Type | Description | Notes |
|---|---|---|---|
| files | File | The images, can be an array | |
| language | String | Language for the response | [optional] |
- Content-Type: multipart/form-data
- Accept: application/json