Method
The method to be called is:
Create/Update Customer vs Create Customer
Using this method, the customer´s existence is verified according to the following criteria:
- Customer number
- NIF
- Email
If the customer 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:
{
"customer": {
"number": 86298,
"name": "JUERGEN SCHOBER",
"address": "",
"postalCode": "",
"city": "",
"country": "DE",
"email": "",
"taxNumber": "233936688",
"phone": "884112332",
"mobilePhone": "332445221",
"iban": "1122333444455",
"bic": "3331444112",
"observations": "This is an example"
}
}
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 Create/Update Customers
Customer
Name | Type | PHC GO Entity | PHC GO Field | Observations |
number | Integer | Cl | no | |
name1 | String | Cl | nome | |
createEstablishment | Boolean | Cl | - | If createEstablishment parameter is activated (true), the number parameter becomes mandatory. |
estab | Integer | Cl | estab | Indicate which establishment you want to update. By default it goes 0. |
address | String | Cl | morada | |
address2 | String | Cl | morada2 | |
postalCode | String | Cl | codpost | |
city | String | Cl | local | |
country1 | String | Cl | pais | Can be set with the full name or the alpha-2 letter ISO3166 format.
Ex. “PT”, “ES”,”US” (See here) |
email | String | Cl | email | |
taxNumber | String | Cl | ncont | Required when PHC Go Application parameter “Tax number required” is True. |
phone | String | Cl | telefone | |
mobilePhone | String | Cl | tlmvl | |
iban | String | Cl | iban | |
bic | String | Cl | swift | |
observations | String | Cl | obs | |
abbreviatedName | String | Cl | nome2 | |
refint | String | Cl | refInt | Internal reference. |
province (required field for Spain and Angola) | String | Cl | provincia | Customer Province. |
county (required field for Angola) | String | Cl | municipio | Customer county. |
Footnotes
1 - Required