Create a saved view

Creates a named view with its initial state and selects it. The state is validated against the surface's configuration: fields, operators, sort and grouping keys and columns must come from /v1/data-views/config. Dashboard views hold no list state; create them with an empty state and place widgets on them with viewId.

Requires: read access to the surface's page: read access to the record type for a records:<typeId> surface, read on users for Members and Roles, read all on api for Webhooks, read all on activityLog for Activity, read on routines for Routines, and read on inboxMessages plus the messaging entitlement for Inbox. Dashboard and record timeline views need no extra permission. Saved views are personal: only the caller's own views are listed or changed.

POST
/v1/data-views/create

Authorization

apiKeyAuth
x-api-key<token>

API key authentication. Create an API key in your user profile and include it in the x-api-key header.

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://customermates.com/api/v1/data-views/create" \  -H "Content-Type: application/json" \  -d '{    "surfaceKey": "records:0b8c7d6e-5f4a-4b3c-9d2e-1f0a9b8c7d6e",    "name": "Open deals",    "state": {      "sortDescriptor": {        "field": "system:updatedAt",        "direction": "desc"      },      "pageSize": 25    }  }'
{
  "action": "surfaces",
  "surfaceKey": "users-card-store",
  "label": "string",
  "path": "string",
  "section": "overview",
  "total": 9007199254740991,
  "page": 1,
  "pageSize": 1,
  "totalPages": 1,
  "items": [
    {
      "id": "string",
      "surfaceKey": "users-card-store",
      "name": "string",
      "label": "string",
      "path": "string",
      "position": -9007199254740991,
      "state": {
        "filters": [
          {
            "field": "string",
            "operator": "equals",
            "value": "string"
          }
        ],
        "searchTerm": "string",
        "sortDescriptor": {
          "field": "string",
          "direction": "asc"
        },
        "pageSize": 5,
        "viewMode": "table",
        "grouping": {
          "field": "string",
          "bucket": "day",
          "hidden": [
            "string"
          ],
          "hideEmpty": true,
          "summaries": [
            {
              "fieldId": "84922011-b03d-4966-bc95-c5b49bc2e342",
              "aggregation": "sum"
            }
          ]
        },
        "columnOrder": [
          "string"
        ],
        "columnWidths": {
          "property1": 0,
          "property2": 0
        },
        "hiddenColumns": [
          "string"
        ],
        "calendar": {
          "dateFieldId": "0e1d975e-73f3-487e-ac80-14e9e130620e",
          "endDateFieldId": "258b375b-74ed-4b5e-99a1-3f54c6fea6e5",
          "colorFieldId": "fb3508bd-25c6-4412-a3bc-eb958a7aa449",
          "mode": "month"
        }
      },
      "field": "string",
      "operators": [
        "string"
      ],
      "property1": null,
      "property2": null
    }
  ],
  "totals": {
    "property1": 9007199254740991,
    "property2": 9007199254740991
  },
  "supportsSearch": true,
  "viewModes": [
    "table"
  ],
  "writableStateFields": [
    "string"
  ],
  "activeViewKey": "string",
  "allState": {
    "filters": [
      {
        "field": "string",
        "operator": "equals",
        "value": "string"
      }
    ],
    "searchTerm": "string",
    "sortDescriptor": {
      "field": "string",
      "direction": "asc"
    },
    "pageSize": 5,
    "viewMode": "table",
    "grouping": {
      "field": "string",
      "bucket": "day",
      "hidden": [
        "string"
      ],
      "hideEmpty": true,
      "summaries": [
        {
          "fieldId": "84922011-b03d-4966-bc95-c5b49bc2e342",
          "aggregation": "sum"
        }
      ]
    },
    "columnOrder": [
      "string"
    ],
    "columnWidths": {
      "property1": 0,
      "property2": 0
    },
    "hiddenColumns": [
      "string"
    ],
    "calendar": {
      "dateFieldId": "0e1d975e-73f3-487e-ac80-14e9e130620e",
      "endDateFieldId": "258b375b-74ed-4b5e-99a1-3f54c6fea6e5",
      "colorFieldId": "fb3508bd-25c6-4412-a3bc-eb958a7aa449",
      "mode": "month"
    }
  },
  "viewKey": "__all__",
  "id": "string",
  "name": "string",
  "position": -9007199254740991,
  "state": {
    "filters": [
      {
        "field": "string",
        "operator": "equals",
        "value": "string"
      }
    ],
    "searchTerm": "string",
    "sortDescriptor": {
      "field": "string",
      "direction": "asc"
    },
    "pageSize": 5,
    "viewMode": "table",
    "grouping": {
      "field": "string",
      "bucket": "day",
      "hidden": [
        "string"
      ],
      "hideEmpty": true,
      "summaries": [
        {
          "fieldId": "84922011-b03d-4966-bc95-c5b49bc2e342",
          "aggregation": "sum"
        }
      ]
    },
    "columnOrder": [
      "string"
    ],
    "columnWidths": {
      "property1": 0,
      "property2": 0
    },
    "hiddenColumns": [
      "string"
    ],
    "calendar": {
      "dateFieldId": "0e1d975e-73f3-487e-ac80-14e9e130620e",
      "endDateFieldId": "258b375b-74ed-4b5e-99a1-3f54c6fea6e5",
      "colorFieldId": "fb3508bd-25c6-4412-a3bc-eb958a7aa449",
      "mode": "month"
    }
  },
  "link": "string",
  "selected": true,
  "deleted": true,
  "proposed": true,
  "trashBatchId": "f9ad794f-414e-4d2a-bff7-4eedbaa196bb",
  "property1": null,
  "property2": null
}
{
  "error": {
    "kind": "validation",
    "issues": [
      {
        "code": "string",
        "path": [
          "string"
        ],
        "message": "string",
        "customCode": "recordNotFound",
        "entitlement": "string"
      }
    ],
    "retryable": true
  }
}
{
  "error": {
    "kind": "validation",
    "issues": [
      {
        "code": "string",
        "path": [
          "string"
        ],
        "message": "string",
        "customCode": "recordNotFound",
        "entitlement": "string"
      }
    ],
    "retryable": true
  }
}
{
  "error": {
    "kind": "validation",
    "issues": [
      {
        "code": "string",
        "path": [
          "string"
        ],
        "message": "string",
        "customCode": "recordNotFound",
        "entitlement": "string"
      }
    ],
    "retryable": true
  }
}
{
  "error": {
    "kind": "validation",
    "issues": [
      {
        "code": "string",
        "path": [
          "string"
        ],
        "message": "string",
        "customCode": "recordNotFound",
        "entitlement": "string"
      }
    ],
    "retryable": true
  }
}
{
  "error": {
    "kind": "validation",
    "issues": [
      {
        "code": "string",
        "path": [
          "string"
        ],
        "message": "string",
        "customCode": "recordNotFound",
        "entitlement": "string"
      }
    ],
    "retryable": true
  }
}
{
  "error": {
    "kind": "validation",
    "issues": [
      {
        "code": "string",
        "path": [
          "string"
        ],
        "message": "string",
        "customCode": "recordNotFound",
        "entitlement": "string"
      }
    ],
    "retryable": true
  }
}
{
  "error": {
    "kind": "validation",
    "issues": [
      {
        "code": "string",
        "path": [
          "string"
        ],
        "message": "string",
        "customCode": "recordNotFound",
        "entitlement": "string"
      }
    ],
    "retryable": true
  }
}
Empty