Object-Based POST

📘

Note that in the following sections, we give examples in CURL format. These can quickly be converted into any language of your choosing by using a tool such as Postman.

This is a two step process where step one would be to import our CURL example into Postman, and step two is to have Postman generate code in your preferred language.

Object-based POST requests use the relevant object key in the URL along with the headers outlined below:

URL
POST https://api.knack.com/v1/objects/object_xx/records

Parameters

ParameterExplanationExample
object_xxobject keyobject_1

Headers

X-Knack-Application-IdYour application ID
X-Knack-REST-API-KEYYour API key
content-typeapplication/json

Example Request

# Create a Company record
curl -X POST "https://api.knack.com/v1/objects/object_1/records" \
  -H "X-Knack-Application-Id: YOUR-APP-ID" \
  -H "X-Knack-REST-API-Key: YOUR-API-KEY" \
  -H "Content-Type: application/json" \
  --data '{
        "field_1": "Name of new company",
        "field_16": {
          "street": "123 Fake St.",
          "city": "Amonate",
          "state": "VA",
          "zip": "24601"
        },
        "field_17": {
          "url": "https://example.com"
        },
        "field_18": "Other",
        "field_31": "555-555-5555"
      }'

Example Response (200 OK)

{
  "id": "58645233669adec2460888c4",
  "field_1": "Name of new company",
  "field_1_raw": "Name of new company",
  "field_16": "123 Fake St.<br />Amonate, VA 24601",
  "field_16_raw": {
    "zip": "24601",
    "state": "VA",
    "city": "Amonate",
    "street": "123 Fake St."
  },
  "field_17": "<a href=\"https://example.com\" target=\"_blank\">https://example.com</a>",
  "field_17_raw": {
    "url": "https://example.com"
  },
  "field_18": "Other",
  "field_18_raw": "Other",
  "field_31": "555-555-5555",
  "field_31_raw": "555-555-5555"
}

What’s Next