# Locations

Locations allow you to represent Creditors, Collectors or Portfolios.

# Create Location

POST https://<org-uuid>.production.tratta.io/api/v1/locations

curl https://<org-uuid>.production.tratta.io/api/v1/locations \
 -H "Authorization: Bearer eyJ0eXA3asdk..." \
 -d name="Location Name"

# Parameters


name required|string

Name of the Location.

type optional|string

One of the supported types of Location:

  • original_creditor
  • current_creditor
  • product_type

If left empty, default value is original_creditor.

Combination of name and type must be unique.

external_id optional|string

External id of location representing Original Creditor, Current Creditor or Product Type in your system.

metadata optional|key:max:255|value:max:255

Json object of key value pairs for meta data you may want to attach to location object.

# Returns


A json with data property that contains created location object.

{
  "id": "string",
  "name": "string",
  "type": "string",
  "external_id": "string",
  "metadata": [{
    "attribute": "key",
    "value": "value"
  }, {
    "attribute": "key1",
    "value": "value"
  }]
}

# Update Location

PUT https://<org-uuid>.production.tratta.io/api/v1/locations/{id|external_id}

curl https://<org-uuid>.production.tratta.io/api/v1/locations/{id|external_id} \
 -H "Authorization: Bearer eyJ0eXA3asdk..." \
 -d name="Location Name"
 -X PUT

# Parameters


name string

Name of the Location.

type optional|string

One of the supported types of Location:

  • original_creditor
  • current_creditor
  • product_type

Combination of name and type must be unique.

external_id string

External id of location representing Original Creditor, Current Creditor or Product Type in your system.

metadata key:max:255|value:max:255

Key value pairs can be updated, when you PUT to the key a different value. When you PUT an empty value to existing key, it will be deleted. When you put and empty value to whole metadata, all of the metadata associated with location object will be deleted.

# Returns


A json with data property that contains created location object.

{
  "id": "string",
  "name": "string",
  "type": "string",
  "external_id": "string",
  "metadata": [{
    "attribute": "key",
    "value": "value"
  }, {
    "attribute": "key1",
    "value": "value"
  }]
}

# Get Location

GET https://<org-uuid>.production.tratta.io/api/v1/locations/{id|external_id}

curl https://<org-uuid>.production.tratta.io/api/v1/locations/{id|external_id} \
 -H "Authorization: Bearer eyJ0eXA3asdk..."

# Parameters


id required_if:external_id missing|string

Uuid of location provided from Tratta when Creating Location object. This url parameter is required only if the external_id wasn't provided instead.

external_id required_if:id missing|string

External id of location provided by you through external_id parameter when Creating Location object. This url parameter is required only if the id wasn't provided instead.

# Returns


A json with data property that contains created location object.

{
  "id": "string",
  "name": "string",
  "type": "string",
  "external_id": "string",
  "metadata": [{
    "attribute": "key",
    "value": "value"
  }, {
    "attribute": "key1",
    "value": "value"
  }]
}

# List Locations

GET https://<org-uuid>.production.tratta.io/api/v1/locations

curl https://<org-uuid>.production.tratta.io/api/v1/locations \
 -H "Authorization: Bearer eyJ0eXA3asdk..."

# Returns


A json with data property that contains array of locations objects.

{
  "id": "string",
  "name": "string",
  "type": "string",
  "external_id": "string",
  "metadata": [{
    "attribute": "key",
    "value": "value"
  }, {
    "attribute": "key1",
    "value": "value"
  }]
}

# Delete Location

DELETE https://<org-uuid>.production.tratta.io/api/v1/locations/{id/external_id}

curl https://<org-uuid>.production.tratta.io/api/v1/locations \
 -H "Authorization: Bearer eyJ0eXA3asdk..." \
 -X DELETE

# Parameters


id required_if:external_id missing|string

Uuid of location provided from Tratta when Creating Location object. This url parameter is required only if the external_id wasn't provided instead.

external_id required_if:id missing|string

External id of location provided by you through external_id parameter when Creating Location object. This url parameter is required only if the id wasn't provided instead.

# Returns


{
  "success": "boolean"
}