Update a client

Change a client's name, reference, metadata or methodologies. Methodology changes recalculate stored travel data.

Updates the editable fields of a client in your hierarchy: name, external_reference, metadata and methodology_configuration. Fields you don't send keep their current values.

The Clients API must be enabled for your account. Until it is, this endpoint responds with 404.

Request

PATCH /v2/clients/{id}

idstring (UUID)required

The client's ID, in the path.

namestring

The new display name.

external_referencestring

Your new reference for the client, unique among the children of its parent.

metadataobject

Your own key-value pairs.

methodology_configurationobject

The new methodology configuration, as { "methodology_options": [...] }. Replaces all current options. Omit it to keep the current configuration.

See every field of PATCH /v2/clients/{id} in the API reference

This request renames the client and switches its hotel methodology from Greenview to HCMI. It sends every option the client keeps, because methodology_options replaces the full list:

{
  "name": "Example Travel Deutschland",
  "methodology_configuration": {
    "methodology_options": [
      { "activity_type": "flight", "methodology": "TIM", "version": "AT_TIME_OF_TRAVEL", "default": true },
      { "activity_type": "flight", "methodology": "DEFRA", "version": "AT_TIME_OF_TRAVEL", "default": false },
      { "activity_type": "train", "methodology": "REM", "default": true },
      { "activity_type": "car", "methodology": "DEFRA", "version": "AT_TIME_OF_TRAVEL", "default": true },
      { "activity_type": "hotel", "methodology": "HCMI", "version": "AT_TIME_OF_TRAVEL", "default": true }
    ]
  }
}

Save it as client-update.json and send it:

curl --request PATCH "https://api.sandbox.squake.earth/v2/clients/4fb3ec7a-92cb-471f-b75f-c3fe7c2a34d5" \
  --header "Authorization: Bearer $SQUAKE_API_KEY" \
  --header "Content-Type: application/json" \
  --data @client-update.json

Response

200 OKapplication/json
{
  "id": "4fb3ec7a-92cb-471f-b75f-c3fe7c2a34d5",
  "name": "Example Travel Deutschland",
  "external_reference": "example-de",
  "parent_id": "0f1f3d3b-2775-4cc0-885e-8d51db6d6de1",
  "status": "active",
  "metadata": { "crm_id": "ACC-1042" },
  "methodology_options": [
    { "activity_type": "flight", "methodology": "TIM", "version": "AT_TIME_OF_TRAVEL", "default": true },
    { "activity_type": "flight", "methodology": "DEFRA", "version": "AT_TIME_OF_TRAVEL", "default": false },
    { "activity_type": "train", "methodology": "REM", "version": null, "default": true },
    { "activity_type": "car", "methodology": "DEFRA", "version": "AT_TIME_OF_TRAVEL", "default": true },
    { "activity_type": "hotel", "methodology": "HCMI", "version": "AT_TIME_OF_TRAVEL", "default": true }
  ]
}

Changing methodologies

  • methodology_options replaces the client's options in full. Send every option the client should keep, not only the ones that change. An empty array clears all options.
  • When the new list differs from the current one, SQUAKE recalculates the activities already stored for the client with the new methodologies. The recalculation runs in the background, and the response returns as soon as the configuration is written.
  • The update is atomic. If the options are invalid, SQUAKE writes nothing, including the other fields in the same request.

Changing the parent

Moving a client to another parent isn't supported. A parent_id that would move the client, including null, is rejected with 400 and error code parent_id_immutable. Sending the client's current parent_id is accepted and ignored, so you can read a client, change a field and send the whole object back.

Errors

StatusCodeMeaning
400parent_id_immutableThe parent_id would move the client to another parent.
400invalid_methodology_optionsmethodology_options can't be read as a list of options.
401The API key is missing or invalid.
404client_not_foundNo client has this ID, or the client is outside your hierarchy.
422invalid_methodology_optionsThe options break a rule. See Methodology options.

On this page

PATCH/v2/clients/{id}

Run this request against the sandbox with your test key.

Open in API reference