Link Search Menu Expand Document

Updated Thu Sep 23rd 2021, 14:49 UTC

Index

GET /:account/opt_outs{?q}

An OptOut is a phone number that has been flagged to prevent delivery of messages.

The response of this endpoint is a representation of a paginated collection of opt outs. To keep our payloads small, each representation is a condensed version of a stored opt out that is focused on relevant information.

This endpoint is also capable of searching across phone numbers.

Examples

List all OptOuts on an Account

Request

GET /my_account/opt_outs
Example
$ curl -i -H Accept:"application/vnd.textus+jsonld" \
    -H Authorization:"Bearer {token}" \
    -X GET /my_account/opt_outs
    

Response

Status

200

Response Type

hydra:Collection

Example
{
  "@type": "hydra:Collection",
  "@context": "/contexts/hydra:Collection.jsonld",
  "id": "/my_account/opt_outs",
  "members": [
    {
      "@type": "OptOut",
      "@context": "/contexts/OptOut.jsonld",
      "id": "/my_account/opt_outs/1",
      "createdAt": "2020-07-30T15:18:52.133Z",
      "formattedPhoneNumber": "(940) 850-3220",
      "displayUserName": "Steph Pitts",
      "createdVia": "User",
      "account": "My Account"
    }
  ],
  "totalItems": 1,
  "view": {
    "@type": "hydra:PartialCollectionView",
    "@context": "/contexts/hydra:PartialCollectionView.jsonld",
    "id": "/my_account/opt_outs?q=303",
    "first": "/my_account/opt_outs",
    "next": null,
    "previous": null
  }
}

Search OptOuts by Phone Number

Request

GET /my_account/opt_outs?q=303
Example
$ curl -i -H Accept:"application/vnd.textus+jsonld" \
    -H Authorization:"Bearer {token}" \
    -X GET /my_account/opt_outs?q=303
    

Response

Status

200

Response Type

hydra:Collection

Example
{
  "@type": "hydra:Collection",
  "@context": "/contexts/hydra:Collection.jsonld",
  "id": "/my_account/opt_outs?q=303",
  "members": [
    {
      "@type": "OptOut",
      "@context": "/contexts/OptOut.jsonld",
      "id": "/my_account/opt_outs/1",
      "createdAt": "2020-07-30T15:18:52.133Z",
      "formattedPhoneNumber": "(940) 850-3220",
      "displayUserName": "Steph Pitts",
      "createdVia": "User",
      "account": "My Account"
    }
  ],
  "totalItems": 0,
  "view": {
    "@type": "hydra:PartialCollectionView",
    "@context": "/contexts/hydra:PartialCollectionView.jsonld",
    "id": "/my_account/opt_outs?q=303",
    "first": "/my_account/opt_outs",
    "next": null,
    "previous": null
  }
}

Table of contents


© 2021 TextUs