Manuais
PHC GO Create/Update Products
 

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:

  1. In case of success:


    {
    "code": 1,
    "message": "Information saved with success.",
    }


  2. In case of error:


    {
    "code": 100,
    "message": "Error message"
    }


 


JSON Specification for Product



Product


 
Name Type PHC GO Entity PHC GO Field Observations
referenceStringStref
designation1StringStdesign
stockIntegerStstockProduct Stock
unitCodeStringStunidade
familyStringStfamiliaThe name of the family of product. Must be the same present in StFami entity
brandStringStusr1
modelStringStusr2
categoryIntegerStcategoryCategory for inventory

(See item 1)
unitPrice1DoubleStepv1
taxIncluded1BooleanStiva1incl
unitPrice2DoubleStepv2
taxIncluded2BooleanStiva2incl
unitPrice3DoubleStepv3
taxIncluded3BooleanStiva3incl
unitPrice4DoubleStepv4
taxIncluded4BooleanStiva4incl
unitPrice5DoubleStepv5
taxIncluded5BooleanStiva5incl
isServiceBooleanStstns
taxExemptionCodeStringSt
taxPercentageIntegerSt
taxRegionStringStShould be in the2 letter ISO3166 format

Ex. “PT”, “ES”,”US” (See here)
barcodeStringStcodigoBarcode field
observationsStringStobs
tecDescriptionStringStdesctec
agreedPriceDoubleStepcusto
agreedPriceIvaInclBooleanStivapcincl
forrefStringStforrefThe supplier reference.
sncCodeIntegerStcpocIt 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)
Other0
Goods1
Finished and intermediate products2
Raw, subsidiar and consumption materials3
By-products, waste and refuse4
Ongoing Products and Works5


Components


 
Name Type PHC GO Entity PHC GO Field Observations
comp_referenceStringScrefComponent product reference.
comp_designationStringScdesignComponent product designation.
comp_quantityIntegerScqtd
comp_fixedQttBooleanScfixoIndicates whether there is a fixed amount of that element in the composed product.
comp_observationsStringScobs

 
(…)

"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
barcodeStringStcbscodigoCode.
designpackStringStcbsdesignpackBarcode description.
quantityDoubleStcbsqttQuantity.
usetag BooleanStcbsusetagTo 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,
}
]

(…)

 


Footnotes


1 - Required



Example