PATCH, POST, PUT & DELETE

This section explains how to use the core REST API verbs within the LogiSense platform to create, update, and delete data. Understanding when to use POST, PUT, PATCH, and DELETE is essential for building reliable integrations and managing objects efficiently across the system. The guidelines and examples below will help you choose the appropriate method based on your use case and data structure.

POST

The POST verb allows you to create a new object. All required fields must be in the payload. Let’s create a country with the following details:

{
    "name": "Germany",
    "sortOrder": "5",
    "countryAddressFormatId": 10,
    "dataTypePostalCodeId": 88,
    "countryCode": "DE",
    "isVisible": true
}

Which will result in the following response:

{
  "trackingId": "e163a2ea-978c-4c27-9a24-180338c6e8a5",
  "type": "create",
  "results": {
    "totalCount": 1,
    "items": [
      {
        "identity": 255,
        "action": "created",
        "dtoTypeKey": "country",
        "instance": {
          "identity": 255,
          "name": "Germany",
          "sortOrder": 5,
          "countryAddressFormatId": 10,
          "countryAddressFormatName": "Address Level 1",
          "dataTypePostalCodeId": 88,
          "dataTypePostalCodeName": "No Validation",
          "countryCode": "DE",
          "isVisible": true
        }
      }
    ]
  }
}

PUT

The PUT verb is used to update properties of an existing object. When making a PUT request, you must include the appropriate update request header and provide only the fields that require modification. This ensures that changes are applied precisely without unintentionally overwriting other values.

PATCH

The PATCH verb allows you to update an object. Just like a put, you only need to supply the fields that will be updated in the payload. However, a patch allows you to update many objects at once. Many objects in the platform are hierarchical in nature – consider an account package that has services and those services in turn have usage identifiers. To update the parent object we would use PUT. But, if you want to update one or more of the children/grandchildren use PATCH. Patch offers a couple of benefits over PUT in that:

  • Patch operations are transactional – if an update fails anywhere in the hierarchy the entire transaction is rolled back so you are not caught with a partial update
  • Object relationships can be implied by the data structure so you are free from the burden of determining the foreign key – If you are updating the usage identifier on an account service you do not have to worry about the account service or an linking tables since you are sending the structure.

DELETE

Delete operations allow you to permanently remove an object from the system, provided it is not currently referenced or depended on by another entity. Before issuing a DELETE request, ensure that any relationships, associations, or downstream dependencies have been removed or reassigned, as the API will prevent deletion to maintain data integrity. This safeguard helps avoid orphaned records and ensures the consistency of billing, rating, and account configurations across the platform.