Updating a Customer
- Endpoint:
/vendor/customer/{Code} - HTTP Method:
PUT - Request Content-Type:
application/json - Authorization: Valid AccessToken is required. (See: 2. Authentication)
Description
This service allows updating an existing customer record in the system. Both individual and corporate customers are supported. Only fields to be updated can be sent; fields not sent remain unchanged.
Note: code and erpCode fields are required. updateCode identifies the existing record, while code represents the new customer code (can be changed).
Header Information
| Header | Required | Description |
|---|---|---|
| Authorization | Yes | Token in Bearer {AccessToken} format |
| Content-Type | Yes | application/json |
Update Reference Field
| Field | Type | Required | Description |
|---|---|---|---|
| updateCode | string | Yes | The member code (code) of the customer to be updated |
Request Body Fields
| Field | Type | Required | Description |
|---|---|---|---|
| code | string | Yes | Customer code (unique). |
| erpCode | string | Yes | Unique customer code in ERP system. |
| firstName | string | Individual | First name for individual customers. |
| lastName | string | Individual | Last name for individual customers. |
| companyName | string | Corporate | Company name for corporate customers. |
| isCompany | boolean | No | true: Corporate, false: Individual. |
| isForeignNational | boolean | No | Is the customer foreign? |
| tckn | string | Individual | Turkish ID number (for individuals). |
| taxNumber | string | Corporate | Tax number (for corporate). |
| taxOffice | string | Corporate | Tax office (for corporate). |
| string | No | Customer email address. | |
| phone | string | No | Landline number. |
| mobile | string | No | Mobile number. |
| countryCode | string | No | Country code (e.g., "TR"). |
| cityCode | string | No | City code. |
| districtCode | integer | No | District code. |
| currencyCode | string | No | Currency code (e.g., "TRY"). |
| address | string | No | Address information. |
| paymentSetId | string | No | Related payment set ID. |
| customerRepresentativeIds | array(string) | No | List of customer representative IDs. |
| canUseMobile | boolean | No | Permission to use mobile app. |
| sendMail | boolean | No | Send notification email after update? |
| isActive | boolean | No | Is the customer active? |
| title | string | No | Title or additional note (optional). |
Note on field name differences: Some field names in the creation service (e.g., countryCode vs countryCodeISO, currencyCode vs currencyTypeId) may differ in this service. Use the names provided in this table for update requests.
- Example Request
- Successful Response
- Example cURL
{
"code": "501",
"erpCode": "501",
"phone": "5000000000",
"countryCode": "TR",
"cityCode": "10",
"districtCode": 494,
"currencyCode": "TRY",
"address": "test",
"taxOffice": "Silifke",
"paymentSetId": "504978bf-bebd-40c5-89aa-b76f3a20341c",
"customerRepresentativeIds": [
"a90b225c-fa6e-418d-8c03-93946a05e355"
],
"isForeignNational": false,
"isCompany": false,
"firstName": "vendor",
"lastName": "test5",
"email": "[email protected]",
"mobile": "5000000000",
"canUseMobile": false,
"sendMail": true,
"isActive": true,
"tckn": "00000000000"
}
{
"status": "success",
"message": "Customer updated successfully"
}
curl --location --request PUT 'https://pgw.netahsilatdemo.com/vendor/customer/501' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzY29wZSI6WyJwd3N2MS5hcGkiLCJlcnB2MS5hcGkiLCJjYXR2MS5hcGkiLCJ2ZW5kb3J2MS5hcGkiXSwiYWN0b3J0Ijoic2VydmljZSIsInJvbGUiOiJzZXJ2aWNlIiwiVW5pcXVlIjoiYTI3NmYyOGEtOWMwYS00NGYxLWIxNjgtMTJiMGY3NTEwMWYzIiwiVGVuYW50SWQiOiI2NzA2ODNjMS0yZmUwLTQ4NDYtODdiMi02Y2JhOWI3OTNhYjIiLCJodHRwOi8vc2NoZW1hcy5taWNyb3NvZnQuY29tL3dzLzIwMDgvMDYvaWRlbnRpdHkvY2xhaW1zL2V4cGlyYXRpb24iOiI2Mzg5NjE5NDQzNzQ5NjM1ODYiLCJuYmYiOjE3NjA0MjQ4MzcsImV4cCI6MTc2MDU5NzYzNywiaWF0IjoxNzYwNDI0ODM3LCJpc3MiOiJzc28uYXBpIiwiYXVkIjoiZWNvenVtLnNzbyJ9.G0FFvRyNF_qCYQvUjvDWzGuf05JpJujSgC5ZMV9_BIQ' \
--data-raw '{
"code": "501",
"erpcode": "501",
"phone": "5000000000",
"countryCode": "TR",
"cityCode": "10",
"districtCode": 494,
"currencyCode": "TRY",
"address": "test",
"taxOffice": "Silifke",
"paymentSetId": "504978bf-bebd-40c5-89aa-b76f3a20341c",
"customerRepresentativeIds": [
"a90b225c-fa6e-418d-8c03-93946a05e355"
],
"isForeignNational": false,
"isCompany": false,
"firstName": "vendor",
"lastName": "test5",
"email": "[email protected]",
"mobile": "5000000000",
"canUseMobile": false,
"sendMail": true,
"isActive": true,
"tckn": "00000000000"
}'
Usage Notes & Best Practices
- Partial Update: Only send the fields to be updated; fields not sent remain unchanged.
- Field Consistency: Field names may differ between creation (POST) and update (PUT) (e.g.,
countryCode↔countryCodeISO). - Identification Fields:
updateCoderefers to the existingcodevalue of the record to be updated. If changingcode, bothupdateCode(old code) andcode(new code) can appear in the body. - Email Notification: If
sendMail=true, a notification email may be triggered according to your system configuration. - Currency/Payment Set: Ensure that
currencyTypeIdandpaymentSetIdvalues are defined in your system; otherwise, a 404 may occur. - Client-side Checks: If the token has expired, refresh it before retrying the request (See: 2.2 Token Expiration and Renewal).