- Docs
- Guides
- Build with Enigma
- GraphQL API
Everything starts with an intent
Pick an intent. It sets the response you get, the inputs you can use, and what the call costs.
The intent drives everything: it controls the type of response you get, the inputs you can use, and how much the API call will cost.
The intents below carry most of the work. The GraphQL reference lists every other read and every write.
| Intent | I would like to… |
|---|---|
search |
…find businesses matching a description, and read their details. |
aggregate |
…count every operating location Enigma holds. |
enrich |
…enrich my own list of businesses using Enigma’s data. |
backgroundTask |
…check the status of a job I started. |
account |
…see my plan, credits or usage. |
Examples
Section titled “Examples”Safeway locations in Texas, five of them, ordered by city. texasLocations
counts all of them so you can see how many the five came from.
query { search(searchInput: { entityType: BRAND name: "Safeway" conditions: { limit: 1 } }) { ... on Brand { id names(first: 1) { edges { node { name } } }
texasLocations: count( field: "operatingLocations" conditions: { filter: { EQ: ["addresses.state", "TX"] } } )
operatingLocations( first: 5 conditions: { filter: { EQ: ["addresses.state", "TX"] } orderBy: ["addresses.city ASC"] } ) { edges { node { addresses(first: 1) { edges { node { streetAddress1 city state } } } } } } } }}How many operating locations does Enigma hold?
aggregate counts a whole entity type. It takes entityType: OPERATING_LOCATION, and it rejects any other value. It does not narrow the
count: name is accepted and then ignored, and conditions on count
raises. To count the locations of one brand, use the count field inside
search, as the search tab does.
query { aggregate(searchInput: { entityType: OPERATING_LOCATION }) { count(field: "operatingLocation") }}Match the merchants in the CSV file and output the enriched results as a new file.
enrich(enrichmentInput: { s3Path: "s3://…/merchants.csv" sourceId: "q3-portfolio" entityType: BRAND output: { filename: "matched", format: CSV }}) { ... on Brand { id }}Poll the enrichment above by the id it returned.
backgroundTask(id: "…") { status result}Check remaining credits before a large run.
account { pricingPlan creditsAvailable}