Skip to main content

Querying Prismatic's API from an HTTP Client

Most modern programming languages implement GraphQL client libraries. You can also curl -X POST queries against the GraphQL API.

In the example below we query the API for all Prismatic components and their labels, descriptions, keys, and whether authorization is required.

Using curl you can pass in a GraphQL query and authorization header.

API_KEY=$(prism me:token)
API_ENDPOINT='https://app.prismatic.io/api/'

QUERY='{
"query":
"query { components { nodes { label description key } } }"
}'

curl ${API_ENDPOINT} -X POST \
-H "Content-Type: application/json" \
-H "Authorization: bearer ${API_KEY}" \
--data "$(echo $QUERY)"