Method
The method to be called is:
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:
{
"supplier": {
"number": 1,
"name": "Test",
"address": "Grand Boulevard 1",
"postalCode": "1234-100",
"city": "Town",
"country": "UK",
"email": "test@test.com",
"taxNumber": "123456789"
},
"requestOptions": {
"option": 1,
"requestedFields": [
"rno",
"rdstamp",
"etotal"
],
"reportName":"Adiantamentos de Fornecedores"
},
"document": {
"docType": 1,
"advancesDoc": 3,
"treasuryType": 2,
"rank": "R10001",
"description": "Api test",
"price": 17.0,
"typeVAT": 4,
"taxExemptionReason": "M03",
"refInt": "0001",
"payType": "1",
"documentObservations": "This is an observation"
}
}
Return Information
Any call made to this method will return a JSON information with this structure:
-
If the option value is “0”:
{
"code": 0,
"message": "Information saved with success and mail sent to client",
"requestedFields":{} /** OBJECT CONTAINING THE REQUESTED FIELDS FROM requestOptions **/
}
-
In case of error:
{
"code": 100,
"message": "Error message"
}
JSON Specification for Create Supplier Advances
Supplier2
Name | Type | PHC GO Entity | PHC GO Field | Observations |
number2 | Integer | Fl | no | |
name2 | String | Fl | nome | |
address2 | String | Fl | morada | |
postalCode2 | String | Fl | codpost | |
city2 | String | Fl | local | |
email2 | String | Fl | email | |
taxNumber2 | String | Fl | ncont | |
abbreviatedName2 | String | Fl | nome2 | |
Request Options
Name | Type | PHC GO Entity | PHC GO Field | Observations |
option1 | Integer | – | – | 0 – Send document by email 1 – Return document pdf link to print 2- Create document without signing (WARNING – For this to work the Document Type must allow drafts. If the document type does not allow drafts the document WILL BE SIGNED) 3- Create document with signing but does not produce pdf and email with pdf for client |
requestedFields | String Array | – | – | The PHC GO supplier advances entity fields to be returned on Success |
reportName | String | – | – | Name of the report type the document should have. If not defined will use one of the reports the user has access to Ex. “Impressão Minimal Simples” |
emailBody | String | – | – | Send document by email with specific body |
emailSubject | String | – | – | Send document by email with specific subject |
Document
Name | Type | PHC GO Entity | PHC GO Field | Observations |
docType1 | Integer | – | – | Serie of document to create. Defaults: – 1 – Advance Invoice |
advancesDoc1 | Integer | Pd | cm | Type of document to create. Defaults: – 1 – N/Fatura (Débito) – 4 – V/Recibo (Débito) – 5 – N/Nt. Débito (Débito) – 6 – V/Nt. Crédito (Débito) |
treasuryType1 | Integer | Pd | contado | Type of document to create. Defaults: – 1 – Caixa – Caixa (EUR) – 2 – Blast – 666123456 (EUR) – 3 – USD Bank – 774589954 (USD) |
rank1 | String | Pd | olcodigo | Type of document to create. Defaults: – P10001 – Operational Activities – Payments to Suppliers – P10002 – Operational Activities – Staff Payments – P10003 – Operational Activities – Income Tax Pag |
description1 | String | Pd | descricao | Some description, at the user’s choice |
price1 | Double | Pd | etotal | Total Advance value |
typeVAT | Integer | Pd | tabiva | Type of VAT. If we omit it, by default it comes like “2”. Defaults options: – 2 – 23% PT Normal – 3 – 13% PT Intermediate – 4 – 0% PT Free tax |
refInt | String | Pd | refInt | Some internal reference, at the user’s choice |
payType | String | Pd | formapag | Define here which payment method you want to make the payment through. Defaults : – 1 – Money – 3 – ATM – 5 – Check |
Footnotes
1 - Required
2 - Supplier can be referenced in two ways:
- On the Document’s supplierNumber field (referencing an existent Supplier)
- As an object (passing this object will also create/update the supplier on PHC Go)