Skip to main content

Update Provider Area

Use this api to update Provider Area

Flow: Validate input then update data.

URL : /api/shipping-manage/provider/areas/{id}

Method : PATCH

Authorization : Use OAuth token

Validate Rule

'id' => ['required', 'exists:delivery_provider_areas,id'],
'store_in_charge' => ['nullable', 'string'],
'status_3pl' => ['nullable', 'int'],
'pmc_status' => ['nullable', 'int'],
'lead_time' => ['nullable', 'exists:lead_time,code'],
'updated_at' => ['required', 'date'], // current updated_at value of entity

Example

{
"store_in_charge": "PXL",
"status_3pl": 0,
"updated_at" : "2023-11-20T07:36:41.000000Z"
}

Success Response

Code : 200 OK

Content example

{
"success": true,
"errors": null,
"errorCode": null,
"data": {
"id": 1,
"province_code": "01",
"district_code": "001",
"province_name": "Thành phố Hà Nội",
"district_name": "Quận Ba Đình",
"zone": "Thành phố Hà Nội - Quận Ba Đình",
"delivery_provider": "viettelpost",
"store_in_charge": "PXL",
"status_3pl": 0,
"pmc_status": 1,
"lead_time": null,
"data": {
"district_id": 22,
"province_id": 1
},
"created_at": "2023-11-20T03:08:18.000000Z",
"updated_at": "2023-11-20T07:36:41.000000Z"
}
}

Error Response

Code : 400 BAD REQUEST

Content :

{
"success": false,
"errors": "Invalid Request!",
"errorCode": 400,
"data": {
"errors": {
"updated_at": [
"Resource not found or has been updated."
]
}
}
}

cURL

curl --location --request PATCH 'https://api-gateway.develop.pharmacity.io/pmc-ecm-delivery-api/api/shipping-manage/provider/areas/1' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer XXXX' \
--data '{
"store_in_charge": "PXL",
"status_3pl": 0,
"updated_at" : "2023-11-20T07:36:41.000000Z"
}'