Skip to content
campaiDeveloper
campai.com

Search

POST/{organizationId}/{mandateId}/searchReads only

Search records

Searches the organization's records for a text, and tolerates typos. It covers contacts, debtors, creditors, receipts, events, groups and Drive files, or only the types you list. You can narrow results with filters on fields and set a limit per type (1 to 20, default 5). It returns records, best match first within each type. Each record has its type, id, title, detail, the params needed to open it, related records and, for contacts, an actor. Only records the caller may read are found, and only by the fields the caller may read. Nothing is changed.

Permissions

Send an API key of the organization in the path, using the X-API-Key header.

Who may call it

  • Only callers acting for an organization can use this endpoint.
  • The caller needs the mandate.read permission.
  • Only records the caller may read are returned. They are matched and shown only by the fields the caller may read. A type in which the caller may read nothing finds nothing.
  • When filters are given, only types that have every filtered field are searched. A type is also skipped when the caller may not read a filtered field or one of its values. If no type is left, records is empty.

Request

Path parameters

  • organizationIdidrequired
  • mandateIdidrequired

Body

Content-Type: application/json

  • searchTermstringrequired

    1–200 characters

  • typesstring[]

    at least 1 items

    contact receipt event group driveFile attendee booking conversation creditor debtor donation resource
  • limitinteger

    1–20 · default 5

  • filtersobject[]

    at most 5 items · default []

    2 properties
    • fieldstringrequired

      1–40 characters

    • valuesstring[]required

      1–20 items · each at most 100 characters

Request
curl --fail-with-body --silent --show-error --max-time 30 --globoff \
  --request POST 'https://cloud.campai.com/api/YOUR_ORGANIZATION_ID/YOUR_MANDATE_ID/search' \
  --header 'X-API-Key: YOUR_API_KEY'

No request that worked has been recorded yet, so the body is not shown.

Response

200 Successful response

Content-Type: application/json

  • recordsobject[]
    7 properties
    • typestring
      contact receipt event group driveFile attendee booking conversation creditor debtor donation resource
    • idid
    • titlestring
    • detailstring
    • paramsobject of string
    • relatedobject of string
    • actorobjectnullable

      If the caller has neither contact.read nor read on any contact type (contact:member, contact:address, contact:customer, contact:sponsor, contact:contributor, contact:employee, contact:supplier), the contact is hidden. records[].actor keeps only a placeholder name that says the caller lacks permission. records[].actor.contact, records[].actor.image and records[].actor.user become null, and records[].actor.nameNormalized and records[].actor.nameSort become empty. records[].title shows the same placeholder name.

      7 properties
      • namestring
      • typestring
      • nameNormalizedstring
      • nameSortstring
      • contactidnullable
      • imageobjectnullable
        4 properties
        • resourcestring

          at least 1 characters

        • fileNamestring

          at most 128 characters

        • contentTypestring

          at most 75 characters

        • fileSizeBytesinteger

          at least 0

      • userobjectnullable
        4 properties
        • namestring

          If the caller lacks user.read, a contact's linked user is hidden unless that user is the caller. records[].actor.user.name becomes a placeholder name that says the caller lacks permission, and records[].actor.user.image becomes null.

        • typestring
        • userIdstring
        • imageobjectnullable
          4 properties
          • resourcestring

            at least 1 characters

          • fileNamestring

            at most 128 characters

          • contentTypestring

            at most 75 characters

          • fileSizeBytesinteger

            at least 0

Response200
{
  "records": [
    {
      "type": "contact",
      "id": "000000000000000000000001",
      "title": "string",
      "detail": "string",
      "params": {
        "key": "string"
      },
      "related": {
        "key": "string"
      },
      "actor": {
        "name": "string",
        "type": "contact",
        "nameNormalized": "string",
        "nameSort": "string",
        "contact": "000000000000000000000001",
        "image": {
          "resource": "string"
        },
        "user": {
          "name": "string",
          "type": "user",
          "userId": "string",
          "image": {
            "resource": "string"
          }
        }
      }
    }
  ]
}

Errors

1 rare error, such as when something changes at the same moment
StatusErrorWhen
500Missing organization accessIf the caller's access to the organization cannot be determined while the search runs.

Errors nearly every request can meet are listed under Errors.