Method
The method to be called is:
Create/Update Product vs Create Product
Using this method, the existence of the product is verified by reference.
If the product exists, the data is updated, otherwise a new one is created with the respective data.
Parameters
In the request headers the Authorization header must have the Access Token:
- Authorization: {{accessToken}}
JSON body
In the body of the POST a JSON structure like this one has to be passed:
{
"product": {
"reference": "prod01",
"designation": "product for test",
"stock": 20,
"unitCode": "M",
"family": "Aluguer",
"category": 2,
"unitPrice1": 15.55,
"taxIncluded1": true,
"unitPrice2": 15.25,
"taxIncluded2": true,
"unitPrice3": 14.55,
"taxIncluded3": true,
"unitPrice4": 115.55,
"taxIncluded4": true,
"unitPrice5": 212.00,
"taxIncluded5": true,
"isService": false,
"taxExemptionCode": "M01",
"taxPercentage": 0,
"taxRegion": "PT",
"barcode": "1122120",
"observations": "Another product",
"tecDescription": "its a tec description",
"agreedPrice": 291,
"agreedPriceIvaIncl": true
}
}
Return Information
Any call made to this method will return a JSON information with this structure:
-
In case of success:
{
"code": 1,
"message": "Information saved with success.",
}
-
In case of error:
{
"code": 100,
"message": "Error message"
}
JSON Specification for Product
Product
Name |
Type |
PHC GO Entity |
PHC GO Field |
Observations |
reference | String | St | ref | |
designation1 | String | St | design | |
stock | Integer | St | stock | Product Stock |
unitCode | String | St | unidade | |
family | String | St | familia | The name of the family of product. Must be the same present in StFami entity |
brand | String | St | usr1 | |
model | String | St | usr2 | |
category | Integer | St | category | Category for inventory
(See item 1) |
unitPrice1 | Double | St | epv1 | |
taxIncluded1 | Boolean | St | iva1incl | |
unitPrice2 | Double | St | epv2 | |
taxIncluded2 | Boolean | St | iva2incl | |
unitPrice3 | Double | St | epv3 | |
taxIncluded3 | Boolean | St | iva3incl | |
unitPrice4 | Double | St | epv4 | |
taxIncluded4 | Boolean | St | iva4incl | |
unitPrice5 | Double | St | epv5 | |
taxIncluded5 | Boolean | St | iva5incl | |
isService | Boolean | St | stns | |
taxExemptionCode | String | St | – | |
taxPercentage | Integer | St | – | |
taxRegion | String | St | – | Should be in the2 letter ISO3166 format
Ex. “PT”, “ES”,”US” (See here) |
barcode | String | St | codigo | Barcode field |
observations | String | St | obs | |
tecDescription | String | St | desctec | |
agreedPrice | Double | St | epcusto | |
agreedPriceIvaIncl | Boolean | St | ivapcincl | |
forref | String | St | forref | The supplier reference. |
sncCode | Integer | St | cpoc | It serves to indicate the SNC code that allows the article to be integrated into CS Accounting. |
Category
Category accept one of the following integers:
Description |
Value (Integer) |
Other | 0 |
Goods | 1 |
Finished and intermediate products | 2 |
Raw, subsidiar and consumption materials | 3 |
By-products, waste and refuse | 4 |
Ongoing Products and Works | 5 |
Components
Name |
Type |
PHC GO Entity |
PHC GO Field |
Observations |
comp_reference | String | Sc | ref | Component product reference. |
comp_designation | String | Sc | design | Component product designation. |
comp_quantity | Integer | Sc | qtd | |
comp_fixedQtt | Boolean | Sc | fixo | Indicates whether there is a fixed amount of that element in the composed product. |
comp_observations | String | Sc | obs | |
(…)
"components":[
{
"comp_reference": "Prod01",
"comp_designation": "Product one",
"comp_quantity": 3,
"comp_fixedQtt": true,
"comp_observations": "Some observations"
},
{
"comp_reference": "Prod02",
"comp_designation": "Product two",
"comp_quantity": 1,
"comp_fixedQtt": true,
"comp_observations": "Some observations 2"
}
]
(…)
Alternative barcodes
Name |
Type |
PHC GO Entity |
PHC GO Field |
Observations |
barcode | String | Stcbs | codigo | Code. |
designpack | String | Stcbs | designpack | Barcode description. |
quantity | Double | Stcbs | qtt | Quantity. |
usetag | Boolean | Stcbs | usetag | To be used on labels. |
(…)
"alternative_barcodes":[
{
"barcode":"123126",,
"designpack":"Api Test 1",
"quantity": "2",,
"usetag": true,
},
{
"barcode":"123127",,
"designpack":"Api Test 2",
""quantity": "3",,
"usetag": false,
}
]
(…)