Skip to main content
Update the details of an existing supplier by its ID.

Endpoint

PUT /api/v1/suppliers/{id}

Path Parameters

id
integer
required
The unique identifier of the supplier to update

Request Body

name
string
required
Name of the supplier company or individual
contactEmail
string
required
Contact email address for the supplier
contactPhone
string
required
Contact phone number for the supplier
isActive
boolean
required
Whether the supplier should be marked as active

Response

Returns the updated supplier object.
id
integer
required
Unique identifier of the supplier
name
string
required
Updated name of the supplier
contactEmail
string
required
Updated contact email address
contactPhone
string
required
Updated contact phone number
isActive
boolean
required
Updated active status

Example Request

curl -X PUT https://api.example.com/api/v1/suppliers/1 \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Premium Furniture Co. Ltd.",
    "contactEmail": "[email protected]",
    "contactPhone": "+1-555-0150",
    "isActive": true
  }'

Example Response

{
  "id": 1,
  "name": "Premium Furniture Co. Ltd.",
  "contactEmail": "[email protected]",
  "contactPhone": "+1-555-0150",
  "isActive": true
}

Status Codes

  • 200 OK - Supplier successfully updated
  • 400 Bad Request - Invalid request body or validation error
  • 404 Not Found - Supplier with the specified ID does not exist

Validation Rules

The following validation rules apply:
  • name - Must not be empty
  • contactEmail - Must be a valid email format
  • contactPhone - Must not be empty
  • isActive - Must be a boolean value

Error Responses

Supplier Not Found

{
  "status": 404,
  "error": "Not Found",
  "message": "Supplier not found with id: 1"
}

Validation Error

{
  "status": 400,
  "error": "Bad Request",
  "message": "Validation failed",
  "errors": [
    {
      "field": "contactEmail",
      "message": "must be a valid email address"
    }
  ]
}

Use Cases

Deactivating a Supplier

To mark a supplier as inactive without deleting their record:
curl -X PUT https://api.example.com/api/v1/suppliers/1 \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Premium Furniture Co.",
    "contactEmail": "[email protected]",
    "contactPhone": "+1-555-0100",
    "isActive": false
  }'

Updating Contact Information

Update only the contact details while keeping other fields the same:
curl -X PUT https://api.example.com/api/v1/suppliers/1 \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Premium Furniture Co.",
    "contactEmail": "[email protected]",
    "contactPhone": "+1-555-0199",
    "isActive": true
  }'

Build docs developers (and LLMs) love