Appearance
Add new partner (customer)
The Partner Creation endpoint in the MyLION ERP system allows you to automate the registration process for new customers. By submitting relevant customer information through this endpoint, you can seamlessly create partner (customer) profiles within the system. Below, you'll find a comprehensive breakdown of the JSON structure for partner registration and instructions on how to use the endpoint effectively.
Endpoint URL
URL: https://api.mylion.hu/v1/partners
Request Method
HTTP Method: POST
Example JSON Request
To register a new partner (customer), you need to provide the necessary information in the form of a JSON payload. Here's an example JSON request:
json
[
{
"identifiers": {
"externalId": "PARTNER123",
},
"firstName": "John",
"lastName": "Doe",
"companyName": "ABC Inc.",
"emails": ["john@example.com", "johndoe@example.com"],
"phone": "123-456-7890",
"legalEntity": true,
"billingAddress": {
"countryCode": "HU",
"city": "Budapest",
"zipCode": "10001",
"street": null,
"streetType": null,
"addressNumber": null,
"building": null,
"floor": null,
"door": null,
"fullStreetAddress": "Test Elek utca 24 1/A",
},
"postalAddress": {
"countryCode": "US",
"city": "Los Angeles",
"zipCode": "90001",
"street": "456 Elm St",
"streetType": "Street",
"addressNumber": "456",
"building": "Building B",
"floor": "3rd Floor",
"door": "301",
"fullStreetAddress": null,
},
"taxNumber": "123456789",
"groupTaxNumber": "987654321",
"euTaxNumber": "EU123456"
}
]java
@Data
public class GenericIdentifiersDTO {
private String externalId;
private Integer mylionId;
}
@Data
public class PartnerDTO {
private GenericIdentifiersDTO identifiers;
private String firstName;
private String lastName;
private String companyName;
private List<String> emails;
private String phone;
private Boolean legalEntity;
private AddressDTO billingAddress;
private AddressDTO postalAddress;
private String taxNumber;
private String groupTaxNumber;
private String euTaxNumber;
}
@Data
public class AddressDTO {
private String countryCode;
private String city;
private String zipCode;
private String street;
private String streetType;
private String addressNumber;
private String building;
private String floor;
private String door;
private String fullStreetAddress;
}JSON Structure Explanation
The highlighted lines are the required properties.
'externalId': A unique external identifier for the partner.
'firstName': First name of the partner. Required if legalEntity is false.
'lastName': Last name of the partner. Required if legalEntity is false.
'companyName': Name of the partner's company. Required if legalEntity is true.
'emails': An array of email addresses associated with the partner.
'phone': Phone number of the partner.
'legalEntity': Indicates whether the partner is a legal entity.
'billingAddress': The billing address details of the partner. See example JSON for details.
'postalAddress': The postal address details of the partner. See example JSON for details.
'taxNumber': Tax number associated with the partner. Required if legalEntity is true.
'groupTaxNumber': Group tax number of the partner.
'euTaxNumber': EU tax number of the partner.
'addresses': In the addresses (billing, postal) other than the highlighted required properties, you need to provide either the fullStreetAddress or the deconstructed street address.
Response Scenarios
HTTP 201 - Created
Upon successful partner registration, you will receive an HTTP 201 response indicating that the partner(s) have been created. The response body will contain a string with comma-separated MyLION partner IDs. Here's an example of a successful response:
json
{
"mylionIds": [
12345
]
}HTTP 400 - Rejected
If there's an issue with partner registration, you might receive an HTTP 400 response. The response will include a detailed error message explaining the reason for rejection. Here's an example of a rejected response:
json
{
"externalId": "PARTNER123",
"errors": [
{
"property": "emails",
"message": "Email format is not valid"
},
{
"property": "phone",
"message": "Phone number format is not valid"
},
{
"property": "taxNumber",
"message": "Not a valid hungarian tax number."
},
{
"property": "euTaxNumber",
"message": "Not a valid tax number."
},
{
"property": "billingAddress",
"message": "Not a valid address."
},
]
}