API Examples
☁️

API Examples

Computed URL

Computed URL

https://<org>.bettrdata.io:1337

Examples

Authentication (2.0)

Endpoint

/auth/token

Description

Get bearer token

HTTP Method

POST

Authentication

  • Required: Yes
  • Type: See Request Body
  • Scope / Permissions (if applicable):

Request

Headers

Name
Required
Type
Description
X-Amz-Target
Yes
String
AWSCognitoIdentityProviderService.InitiateAuth
Content-Type
Yes
String
application/x-amz-json-1.1

Request Body

{
    "AuthFlow": "USER_PASSWORD_AUTH",
    "ClientId": "<client_id>",
    "AuthParameters": {
      "USERNAME": "<username>",
      "PASSWORD": "<password>"
    }
}

Response

Success Response

Status Code: 200 OK

{
	"token":"jwt_token_here",
	"expires_in":3600
}

Field
Type
Description
token
String
JWT access token
expires_in
Number
Expiry time in seconds

Error Responses

Status Code
Message
When it Happens
400
Bad Request
Invalid input
401
Unauthorized
Invalid credentials
403
Forbidden
Insufficient permissions
500
Server Error
Unexpected failure

Notes / Edge Cases

  • Tokens expire after 1 hour
  • Rate limited to 100 requests/minute
  • This endpoint is idempotent

Example Request

Search: Datafile

Endpoint

/datafile

Description

Find a datafile

HTTP Method

GET

Authentication

Required: Yes

  • Type: Bearer Token
  • Scope / Permissions (if applicable):

Request

Headers

Name
Required
Type
Description
Authorization
Yes
String
Bearer <token>
Content-Type
Yes
String
application/json

Query Parameters

Name
Required
Type
Description
where
No
Object
Generally follows mongodb query structure, see query documents
sort
No
Object
limit
No
Number
Number of records to limit in the response

Response

Success Response

Status Code: 200 OK

[
	{DatafileModel}
]

Error Responses

Status Code
Message
When it Happens
400
Bad Request
Invalid input
401
Unauthorized
Invalid credentials
403
Forbidden
Insufficient permissions
500
Server Error
Unexpected failure

Create: Merge Run

Endpoint

/mergerun

Description

Create a Merge job to union, omit, select, or join multiple feeds together.

HTTP Method

POST

Authentication

  • Required: Yes
  • Type: Bearer Token
  • Scope / Permissions (if applicable):

Request

Headers

Name
Required
Type
Description
Authorization
Yes
String
Bearer <token>
Content-Type
Yes
String
application/json

Query Parameters

Name
Required
Type
Description

Path Parameters

Name
Required
Type
Description

Request Body

Field
Type
Description
convertType
String
JWT access token
convertsToMerge
Merge Item []
Merge Item Entry
convertType
String
Output Schema / Process to apply
description
String
Freeform text description
ready
Boolean
Run now if set to true
mergeItem.mergeInputType
Enumeration
UNION | OMIT | SELECT | JOIN

Response

Success Response

Status Code: 200 OK

{
	<updated object w/ ID here>
}

Error Responses

Status Code
Message
When it Happens
400
Bad Request
Invalid input
401
Unauthorized
Invalid credentials
403
Forbidden
Insufficient permissions
500
Server Error
Unexpected failure

Notes / Edge Cases

Example Request

Additional References