Trade Partners & LocationsUpdate a Trade Partner / Location

Update Trade Partner Or Location

Updates a standard location or its associated trade-partner information. The existing location id and TradePartner.Id identify the records being updated. The request body is a single Location object, not a Locations array; an array returns 422. Name is required in every update. Omitting licenseNumber or locationGroup keeps the current value; omitting GeoCoordinates resets the coordinates to 0, 0.

curl -X PUT "https://connect.wholechain.com/Integration/Location" \
  -H "Content-Type: application/json" \
  -H "X-API-KEY: example_string" \
  -d '{
  "Location": {
    "id": "OCEANIC-PLANT-001",
    "Details": {
      "TradePartner": {
        "Id": "OCEANIC-EXPORTS",
        "Name": "Oceanic Exports",
        "ConnectionType": "SUPPLIER"
      },
      "Name": "Oceanic Processing Plant",
      "Gln": "9506000140445",
      "Extension": "PLANT-A",
      "Duns": "123456789",
      "ContactInformation": {
        "Name": "Maria Jacobs",
        "Phone": "+27 21 555 0142",
        "Email": "maria.jacobs@oceanicexports.example"
      },
      "Address": {
        "City": "Cape Town",
        "State": "Western Cape",
        "Country": "South Africa",
        "AddressLine1": "12 Marine Drive",
        "AddressLine2": "Paarden Eiland",
        "PostalCode": "7405",
        "GeoCoordinates": {
          "Latitude": -33.9208,
          "Longitude": 18.474
        },
        "DisplayAddress": "12 Marine Drive, Paarden Eiland, Cape Town, Western Cape, South Africa, 7405"
      },
      "licenseNumber": "LIC-12345",
      "locationGroup": {
        "identifier": "GROUP-001",
        "name": "Processing Plants",
        "description": "Primary processing plant group"
      },
      "customData": [
        {
          "name": "Facility Type",
          "namespace": "custom",
          "value": "Processing"
        }
      ]
    }
  }
}'
{
  "message": "Success",
  "result": {
    "id": "01a0e83e-dcd2-76e0-b008-5f4693db2d76",
    "accountId": "5a6b41f6-5a48-4a54-b94c-4a89125b7c7d",
    "tradePartnerId": "01a0e83e-dcc8-7cbf-843c-a896fd05ce90",
    "networkStatus": "NonWholechain",
    "tradePartnerName": "Oceanic Exports",
    "tradePartnerUrn": "urn:gdst:wholechain.com:party:oceanicexports.0",
    "name": "Oceanic Processing Plant",
    "gln": "9506000140445",
    "duns": null,
    "externalIdentifier": "OCEANIC-PLANT-001",
    "extension": "PLANT-A",
    "captainsName": null,
    "urn": "urn:gdst:wholechain.com:location:loc:oceanagroupltd.oceanicprocessingplant",
    "hasActiveInventory": false,
    "address": {
      "city": "Cape Town",
      "state": "Western Cape",
      "country": "South Africa",
      "addressLine1": "12 Marine Drive",
      "addressLine2": "Paarden Eiland",
      "postalCode": "7405",
      "geoCoordinates": {
        "latitude": -33.9208,
        "longitude": 18.474
      },
      "displayAddress": "12 Marine Drive, Paarden Eiland, Cape Town, Western Cape, South Africa"
    },
    "contact": null,
    "vessel": null,
    "wholechainId": null,
    "sharedWith": [],
    "createdTime": null,
    "isDefault": false,
    "geoJson": null,
    "foodFacilityRegistrationNumber": null,
    "locationGroupId": "00000000-0000-0000-0000-000000000000",
    "locationType": null,
    "locationGroup": {
      "id": "00000000-0000-0000-0000-000000000000",
      "name": "Processing Plants",
      "description": "Primary processing plant group",
      "externalIdentifier": "GROUP-001"
    },
    "dataPolicyElements": null,
    "ownerInfo": null
  },
  "errors": [],
  "validations": []
}
PUT
/Integration/Location
PUT
Base URLstring

Target server for requests. Edit to use your own host.

Content-Typestring
Required

The media type of the request body

Options: application/json
header
X-API-KEYstring
Required

API key used to authenticate the request.

Request Preview
Response

Response will appear here after sending the request

Responses

messagestring
Required
resultobject
Required
errorsobject[]
Required
validationsobject[]
Required

Introduction

This API allows you to update an existing trade partner, location, or vessel in Wholechain.

To update a record, use its existing ID and submit the updated details.

The request body is a single Location object, not a Locations array. A Locations array returns 422 with the title 'Location' must not be empty.

Important: IDs cannot be changed.

  • TradePartner.Id cannot be updated.
  • Location id cannot be updated.
  • Use the existing ID to identify the record you want to update.

You can only update records that belong to your own Wholechain account.

Locations that have been shared to your account by another Wholechain account cannot be edited.

For vessel updates, see Update a vessel.


Update a Trade Partner

To update a trade partner, provide the existing TradePartner.Id together with the updated trade partner details.

You can update fields such as:

  • Name
  • ConnectionType

Example

{
  "Location": {
    "id": "LOCATION-001",
    "Details": {
      "TradePartner": {
        "Id": "TP-001",
        "Name": "Updated Trade Partner Name",
        "ConnectionType": "SUPPLIER"
      },
      "Name": "Oceanic Processing Plant",
      "Address": {
        "City": "Cape Town",
        "Country": "South Africa",
        "AddressLine1": "123 Processing Street"
      }
    }
  }
}

In this example:

  • TP-001 identifies the existing trade partner.
  • The trade partner ID remains unchanged.
  • The trade partner name and connection type are updated.
  • The location Name is included because every location update must contain it.

Update a Location

To update a location, provide the existing location id and the existing TradePartner.Id, then submit the updated location details.

The location ID itself cannot be changed.

The location details can also include licenseNumber, locationGroup (an object with identifier, name, and description), and customData (an array of name, namespace, and value entries). These fields are described on Create a Location / Trade Partner. To manage location groups themselves, see Update a Location Group.

Update Rules

  • Name is required in every update. Without it, the API returns 422 with the title Location name is required.
  • If you omit licenseNumber or locationGroup, the current value is kept. The location stays in its current group.
  • If you omit GeoCoordinates, the coordinates are reset to 0, 0. Send the current coordinates again to keep them.
  • Changing Name also changes the location's urn.
  • locationGroup is matched by identifier. If the group exists, the location is assigned to it, and any name or description you send replaces the group's current values. If the group doesn't exist, it is created.
  • Each customData name must match a custom data element that already exists in your account. Otherwise the API returns 422 with the title Location custom data name was not found: <name>. and the location is not updated.

Example

{
  "Location": {
    "id": "LOCATION-001",
    "Details": {
      "TradePartner": {
        "Id": "TP-001",
        "Name": "Oceanic Exports",
        "ConnectionType": "SUPPLIER"
      },
      "Name": "Updated Processing Plant Name",
      "Gln": "9506000140445",
      "Extension": "UpdatedExtension",
      "ContactInformation": {
        "Name": "New Contact Name",
        "Phone": "+1234567890",
        "Email": "newcontact@example.com"
      },
      "Address": {
        "City": "Updated City",
        "State": "Updated State",
        "Country": "United States",
        "AddressLine1": "456 New Address",
        "PostalCode": "12345"
      },
      "licenseNumber": "LIC-12345",
      "locationGroup": {
        "identifier": "GROUP-001",
        "name": "Processing Plants",
        "description": "Primary processing plant group"
      },
      "customData": [
        {
          "name": "Facility Type",
          "namespace": "custom",
          "value": "Processing"
        }
      ]
    }
  }
}

Response

200 — OK

The response contains message (Success) and result, the updated location. result includes locationGroupId and locationGroup (with id, name, description, and externalIdentifier).

Retrieve a Location and List Locations currently return locationGroup as null, even when the location belongs to a group. The update response shows the assigned group.

Error Responses

Errors are returned as a problem details object with type, title, status, and traceId.

StatusCause
400The X-API-KEY header is missing, or the request body can't be read.
422The body uses a Locations array instead of a Location object, Name is missing, or a customData name doesn't match an existing data element.

Important Notes

  • The request body is a single Location object, not an array.
  • Name is required in every update.
  • TradePartner.Id cannot be changed.
  • Location id cannot be changed.
  • Always use the existing ID to identify the record being updated.
  • Trade partner details such as Name and ConnectionType can be updated.
  • Location details such as name, address, contact information, GLN, extension, licenseNumber, locationGroup, and customData can be updated.
  • Locations shared to your account by another Wholechain account are read-only and cannot be updated.