PATCH
/
sources
/
{source_id}
/
models
/
{model_id}
curl --request PATCH \
  --url https://app.getcensus.com/api/v1/sources/{source_id}/models/{model_id} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "name": "New App Users",
  "query": "SELECT * FROM \"users\"",
  "description": "Users that have signed up for our product in the last week."
}'
{
  "status": "updated",
  "data": {
    "type": "model",
    "id": 18,
    "source_object_id": 20,
    "name": "New App Users",
    "datset_id": 12,
    "description": "Users that have signed up for our product in the last week.",
    "query": "SELECT * FROM \"users\"",
    "created_at": "2021-10-20T02:43:07.120Z",
    "updated_at": "2021-10-20T02:50:35.477Z",
    "compiled_query": "<string>",
    "columns": [
      {
        "name": "user_id",
        "type": "character varying (256)"
      },
      {
        "name": "full_name",
        "type": "character varying (256)"
      }
    ]
  }
}

Authorizations

Authorization
string
headerrequired

Bearer token for the current workspace. Can be retrieved from the Workspace's settings page.

Path Parameters

source_id
integer
required

ID of the source

model_id
integer
required

ID of the model

Body

application/json
name
string

The name of this model.

query
string

The SQL query associated with this model.

description
string

The description for this model.

Response

200 - application/json
status
enum<string>

Outcome of the operation.

Available options:
success,
updated,
created,
not_found,
error
data
object