Manta Developers
GitHub
Menu

GraphQL

Post GraphQL operations to your Manta deployment.

What it is

GraphQL is how a backend runs operations such as rules and action plans. Send the operation as JSON to /graphql on your Manta deployment (by default https://app.hiremanta.com).

Import

There is no package import. Call the endpoint with curl:

curl https://app.hiremanta.com/graphql \
  -H "Authorization: Bearer $MANTA_TOKEN" \
  -H "x-manta-datastore: your-datastore" \
  -H "Content-Type: application/json" \
  -d '{"query": "query { rules(limit: 5) { count rules { ruleIri committedRule } } }"}'

Example

query {
  rules(limit: 5) {
    count
    rules {
      ruleIri
      committedRule
    }
  }
}

Request

POST /graphql with these headers:

  • Authorization: Bearer <access token>
  • x-manta-datastore: <datastore>
  • Content-Type: application/json

The body is a JSON object whose query field is the operation text.

Response

The response is the GraphQL JSON envelope. For the query above, data.rules carries count and rules, and each rule carries ruleIri and committedRule:

{
  "data": {
    "rules": {
      "count": 1,
      "rules": [
        {
          "ruleIri": "https://example.org/rule/1",
          "committedRule": ":cpc[?ad, ?cpc] :- :Ad[?ad], :spend[?ad, ?spend], :clicks[?ad, ?clicks], FILTER(?clicks > 0), BIND(?spend / ?clicks AS ?cpc) ."
        }
      ]
    }
  }
}