Skip to main content

Querying Prismatic's API from an HTTP Client

You can query Prismatic's GraphQL API using any HTTP client library in your preferred programming language. Most modern languages implement GraphQL client libraries, or you can use simple HTTP POST requests with tools like curl.

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

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)"