APIs
Getting Started

Getting Started with Grepr APIs

Setup Authentication

Overview

To interact with Grepr APIs, you will require credentials that the Grepr support team will provide. Please contact Grepr support for access, we will do our best to get in touch with you at the earliest. If everything works out, you should have received the following set of credentials:

  • Client ID : A unique identifier for your organization.
  • Client Secret : A secret key that is used to authenticate your organization.

Obtain an Access Token

Grepr uses Auth0 (opens in a new tab) for authentication. You will need to obtain an access token from Auth0 by hitting the POST https://grepr-prod.us.auth0.com/oauth/token endpoint.

Example request using curl:

curl --url https://grepr-prod.us.auth0.com/oauth/token \
--header 'content-type: application/json' \
--data '{
  "client_id": "<client_id>",
  "client_secret": "<client_secret>",
  "audience": "service",
  "grant_type": "client_credentials"
}'

Example response:

{
    "access_token": "<access_token>",
    "token_type": "Bearer",
    "expires_in": "86400",
    "scope": "service"
}

Note: This token will have access to all APIs that Grepr provides to its customers. Alternatively, you can also request us to scope these down to specific APIs that you need access to.

Interact with Grepr

Once you have the access token, include it in the Authorization header of your API requests as a Bearer token.

Example request for getting all Asynchronous Streaming jobs using curl:

curl -XGET "https://<your_org_id>.app.grepr.ai/api/v1/jobs?processing=STREAMING&execution=ASYNCHRONOUS" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <your_access_token>"

A successful request will return the requested data. If the token has expired, you'll receive a 401 Unauthorized response. In that case, you'll need to obtain a new token using the steps above.

Example response:

{
  "items": [
    {
      "id": "0ABC123DEF456",
      "name": "Demo Job",
      "version": 0,
      "organizationId": "grepr",
      "execution": "ASYNCHRONOUS",
      "processing": "STREAMING",
      "state": "RUNNING",
      "desiredState": "RUNNING",
      "jobGraph": {
        "vertices": [],
        "edges": []
      },
      "createdAt": "2021-09-01T00:00:00Z",
      "updatedAt": "2021-09-01T00:00:00Z",
      "tags": {
        "createdUsing": "API",
        "createdByUser": "Hardworking Beaver"
      }
    }
  ]
}

Notes

  • Token Expiration : The access token has a limited lifetime (usually 86400 seconds / 24 hours). You will need to obtain a new token once it expires.
  • Security : Keep the credentials you receive and the auth token secure. Do not expose it in your client-side code or version control, this can potentially lead to unauthorized access to your data.

Next steps