Query Targets

Search for targets:
POST /targets/actions/query

Search for targets by property values. Returns an array of all matching target resources.

See also:
Create a target
Delete a target

Uses and Requirements

Request Components

HTTP Request

POST https://thingspace.verizon.com/api/cc/v1/targets/actions/query

Resource Path and Query Parameters

None.

Header Parameters

The request header must contain a current ThingSpace authorization token and a current VZ-M2M session token, and must set the content-type to JSON.

Property Name Data Type Description
Authorization
required
string HTTP Authorization request header containing a valid ThingSpace Bearer token.
VZ-M2M-Token
required
string A valid session token returned by a Connectivity Management API POST /session/login request using the account’s UWS credentials.
Content-Type
required
string Must be application/json.

Request Body

The request body specifies fields and values to match.

Property Name Data Type Description
accountidentifier
required
JSON object The ID of the authenticating billing account, in the format {"billingaccountid":"1234567890-12345"}.
$selection
optional
JSON object A comma-separated list of properties and comparator values to match against targets in the ThingSpace account. See Working with Query Filters for more information. If the request does not include $selection, the response will include all targets to which the requesting user has access.

Example Request

Find a target by its UUID

curl -X POST https://thingspace.verizon.com/api/cc/v1/targets/actions/query \
  -H 'Authorization: Bearer 225aec324bb619d10101ca905fd2479e' \
  -H 'VZ-M2M-Token: 85d73f80-3127-4d04-81ae-82497cc557dd' \
  -H 'Content-Type: application/json' \
  -d '{
    "accountidentifier": {"billingaccountid":"1223334444-00001"}
    "resourceidentifier": {"id": "dd1682d3-2d80-cefc-f3ee-25154800beff"}
  }'

Find all AWS targets

curl -X POST https://thingspace.verizon.com/api/cc/v1/targets/actions/query \
  -H 'Authorization: Bearer 225aec324bb619d10101ca905fd2479e' \
  -H 'VZ-M2M-Token: 85d73f80-3127-4d04-81ae-82497cc557dd' \
  -H 'Content-Type: application/json' \
  -d '{
    "accountidentifier": {"billingaccountid":"1223334444-00001"}
    "$selection": {"addressscheme": "streamawsiot"}
  }'

Success Responses

Status 200

A success response includes an array of all matching targets. Each target includes the full target resource definition.

Property Name Data Type Description
address string The endpoint for data streams.
addressscheme string The transport format.
createdon string, date-time The date the resource was created.
description string Description of the target.
externalid string Security identification string.
id string, UUID ThingSpace unique ID for the target that was created.
kind string Identifies the resource kind. Targets are ts.target.
lastupdated string, date-time The date the resource was last updated.
name string Name of the target.
version string Version of the underlying schema resource.
versionid string, UUID The version of the resource.
billingaccountid string, UUID The billingaccount ID.

Example Success Response

[
  {
    "address": "https://myhost.com:1825",
    "addressscheme": "streamrest",
    "createdon": "2018-12-22T03:59:18.563Z",
    "id": "cee10900-f54e-6eef-e455-bd7f15c4be32",
    "kind": "ts.target",
    "lastupdated": "2018-12-22T03:59:18.563Z",
    "name": "host:port target",
    "version": "1.0",
    "versionid": "f4be7c2b-059d-11e9-bec6-02420a4e1b0a"
  },
  {
    "address": "arn:aws:iam::252156542789:role/ThingSpace",
    "addressscheme": "streamawsiot",
    "createdon": "2019-01-24T19:06:43.577Z",
    "externalid": "lJZnih8BfqsosZrEEkfPuR3aGOk2i-HIr6tXN275ioJF6bezIrQB9EbzpTRep8J7RmV7QH==",
    "id": "cea170cc-a58f-6531-fc4b-fae1ceb1a6c8",
    "kind": "ts.target",
    "lastupdated": "2019-01-24T19:32:31.841Z",
    "name": "AWS Target",
    "region": "us-east-1",
    "version": "1.0",
    "versionid": "caf85ff7-200e-11e9-a85b-02420a621e0a"
  }
]

Failure Responses

Status 4xx

All error messages are returned in this format:

{
  "error": "error code string",
  "error_description": "error message string",
  "cause": "further explanation"
}

Error codes and messages are listed on the Error Messages page, along with explanations and suggestions for corrective actions.