Skip to main content

Update Contact

Update an existing contact.

HTTP Request

PATCH/api/contacts/:id

Authorization

Authorization

  • Required: Yes
  • Permission: Staff or Admin
  • Authentication: Token-based (Authorization: Token <your_api_key>)

Path Parameters

ParameterTypeRequiredDescription
idIntegerYesUnique ID of the contact to update

Request Body

FieldTypeRequiredDescription
subjectStringNoThe subject of the contact.
messageStringNoThe message content of the contact.
first_nameStringNoThe first name of the contact.
last_nameStringNoThe last name of the contact.
emailStringNoThe email address of the contact.
mobile_numberStringNoMobile number associated with the contact.

Example Requests

1import requests
2
3api = requests.Session()
4api.headers.update({'Authorization': 'Token <your_api_key>'})
5response = api.patch('http://www.example.com/api/contacts/<ID>', json={
6  'subject': 'New Subject',
7  'message': 'Updated message content.',
8  'first_name': 'John',
9  'last_name': 'Doe',
10  'email': 'john.doe@example.com',
11  'mobile_number': '123-456-7890'
12})
13print(response.json())

Status Codes

CodeDescription
200Contact updated successfully
400Bad request — invalid input
401Unauthorized — authentication required
403Forbidden — insufficient permissions
404Contact not found
500Internal server error

Response Fields

FieldTypeDescription
idIntegerUnique ID of the contact
subjectStringThe subject of the contact
messageStringThe message content of the contact
first_nameStringThe first name of the contact
last_nameStringThe last name of the contact
emailStringThe email address of the contact
mobile_numberStringMobile number associated with the contact
viewedBooleanWhether the contact has been viewed
viewed_atString (ISO 8601)Timestamp when the contact was viewed
created_atString (ISO 8601)Timestamp when the contact was created
updated_atString (ISO 8601)Timestamp when the contact was last updated