Skip to content

Latest commit

 

History

History
287 lines (193 loc) · 9.29 KB

ProductsApi.md

File metadata and controls

287 lines (193 loc) · 9.29 KB

fattureInCloudSdk.ProductsApi

All URIs are relative to https://api-v2.fattureincloud.it

Method HTTP request Description
createProduct POST /c/{company_id}/products Create Product
deleteProduct DELETE /c/{company_id}/products/{product_id} Delete Product
getProduct GET /c/{company_id}/products/{product_id} Get Product
listProducts GET /c/{company_id}/products List Products
modifyProduct PUT /c/{company_id}/products/{product_id} Modify Product

createProduct

CreateProductResponse createProduct(companyId, opts)

Create Product

Creates a new product.

Example

import fattureInCloudSdk from '@fattureincloud/fattureincloud-js-sdk';
let defaultClient = fattureInCloudSdk.ApiClient.instance;
// Configure OAuth2 access token for authorization: OAuth2AuthenticationCodeFlow
let OAuth2AuthenticationCodeFlow = defaultClient.authentications['OAuth2AuthenticationCodeFlow'];
OAuth2AuthenticationCodeFlow.accessToken = 'YOUR ACCESS TOKEN';

let apiInstance = new fattureInCloudSdk.ProductsApi();
let companyId = 12345; // Number | The ID of the company.
let opts = {
  'createProductRequest': {"data":{"name":"Tavolo di marmo","code":"TAVOLO003","net_price":240,"net_cost":0,"measure":"","description":"Tavolo in marmo pregiato","category":"arredamento","in_stock":true,"default_vat":{"id":3,"value":22,"description":"Non imponibile art. 123","notes":"IVA non imponibile ai sensi dell'articolo 123, comma 2","is_disabled":false}}} // CreateProductRequest | 
};
apiInstance.createProduct(companyId, opts).then((result) => {
  console.log('API called successfully. Returned result: ' + JSON.stringify(result));
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
companyId Number The ID of the company.
createProductRequest CreateProductRequest [optional]

Return type

CreateProductResponse

Authorization

OAuth2AuthenticationCodeFlow

HTTP request headers

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

deleteProduct

deleteProduct(companyId, productId)

Delete Product

Deletes the specified product.

Example

import fattureInCloudSdk from '@fattureincloud/fattureincloud-js-sdk';
let defaultClient = fattureInCloudSdk.ApiClient.instance;
// Configure OAuth2 access token for authorization: OAuth2AuthenticationCodeFlow
let OAuth2AuthenticationCodeFlow = defaultClient.authentications['OAuth2AuthenticationCodeFlow'];
OAuth2AuthenticationCodeFlow.accessToken = 'YOUR ACCESS TOKEN';

let apiInstance = new fattureInCloudSdk.ProductsApi();
let companyId = 12345; // Number | The ID of the company.
let productId = 56; // Number | The ID of the product.
apiInstance.deleteProduct(companyId, productId).then(() => {
  console.log('API called successfully.');
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
companyId Number The ID of the company.
productId Number The ID of the product.

Return type

null (empty response body)

Authorization

OAuth2AuthenticationCodeFlow

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

getProduct

GetProductResponse getProduct(companyId, productId, opts)

Get Product

Gets the specified product.

Example

import fattureInCloudSdk from '@fattureincloud/fattureincloud-js-sdk';
let defaultClient = fattureInCloudSdk.ApiClient.instance;
// Configure OAuth2 access token for authorization: OAuth2AuthenticationCodeFlow
let OAuth2AuthenticationCodeFlow = defaultClient.authentications['OAuth2AuthenticationCodeFlow'];
OAuth2AuthenticationCodeFlow.accessToken = 'YOUR ACCESS TOKEN';

let apiInstance = new fattureInCloudSdk.ProductsApi();
let companyId = 12345; // Number | The ID of the company.
let productId = 56; // Number | The ID of the product.
let opts = {
  'fields': "fields_example", // String | List of comma-separated fields.
  'fieldset': "fieldset_example" // String | Name of the fieldset.
};
apiInstance.getProduct(companyId, productId, opts).then((result) => {
  console.log('API called successfully. Returned result: ' + JSON.stringify(result));
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
companyId Number The ID of the company.
productId Number The ID of the product.
fields String List of comma-separated fields. [optional]
fieldset String Name of the fieldset. [optional]

Return type

GetProductResponse

Authorization

OAuth2AuthenticationCodeFlow

HTTP request headers

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

listProducts

ListProductsResponse listProducts(companyId, opts)

List Products

Lists the products.

Example

import fattureInCloudSdk from '@fattureincloud/fattureincloud-js-sdk';
let defaultClient = fattureInCloudSdk.ApiClient.instance;
// Configure OAuth2 access token for authorization: OAuth2AuthenticationCodeFlow
let OAuth2AuthenticationCodeFlow = defaultClient.authentications['OAuth2AuthenticationCodeFlow'];
OAuth2AuthenticationCodeFlow.accessToken = 'YOUR ACCESS TOKEN';

let apiInstance = new fattureInCloudSdk.ProductsApi();
let companyId = 12345; // Number | The ID of the company.
let opts = {
  'fields': "fields_example", // String | List of comma-separated fields.
  'fieldset': "fieldset_example", // String | Name of the fieldset.
  'sort': "sort_example", // String | List of comma-separated fields for result sorting (minus for desc sorting).
  'page': 1, // Number | The page to retrieve.
  'perPage': 5, // Number | The size of the page.
  'q': "q_example" // String | Query for filtering the results.
};
apiInstance.listProducts(companyId, opts).then((result) => {
  console.log('API called successfully. Returned result: ' + JSON.stringify(result));
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
companyId Number The ID of the company.
fields String List of comma-separated fields. [optional]
fieldset String Name of the fieldset. [optional]
sort String List of comma-separated fields for result sorting (minus for desc sorting). [optional]
page Number The page to retrieve. [optional] [default to 1]
perPage Number The size of the page. [optional] [default to 5]
q String Query for filtering the results. [optional]

Return type

ListProductsResponse

Authorization

OAuth2AuthenticationCodeFlow

HTTP request headers

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

modifyProduct

ModifyProductResponse modifyProduct(companyId, productId, opts)

Modify Product

Modifies the specified product.

Example

import fattureInCloudSdk from '@fattureincloud/fattureincloud-js-sdk';
let defaultClient = fattureInCloudSdk.ApiClient.instance;
// Configure OAuth2 access token for authorization: OAuth2AuthenticationCodeFlow
let OAuth2AuthenticationCodeFlow = defaultClient.authentications['OAuth2AuthenticationCodeFlow'];
OAuth2AuthenticationCodeFlow.accessToken = 'YOUR ACCESS TOKEN';

let apiInstance = new fattureInCloudSdk.ProductsApi();
let companyId = 12345; // Number | The ID of the company.
let productId = 56; // Number | The ID of the product.
let opts = {
  'modifyProductRequest': {"data":{"name":"Tavolo di marmo","code":"TAVOLO003","net_price":240,"net_cost":0,"measure":"","description":"Tavolo in marmo pregiato","category":"arredamento","in_stock":true,"default_vat":{"id":3,"value":22,"description":"Non imponibile art. 123","notes":"IVA non imponibile ai sensi dell'articolo 123, comma 2","is_disabled":false}}} // ModifyProductRequest | Modified product details.
};
apiInstance.modifyProduct(companyId, productId, opts).then((result) => {
  console.log('API called successfully. Returned result: ' + JSON.stringify(result));
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
companyId Number The ID of the company.
productId Number The ID of the product.
modifyProductRequest ModifyProductRequest Modified product details. [optional]

Return type

ModifyProductResponse

Authorization

OAuth2AuthenticationCodeFlow

HTTP request headers

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