Skip to content

Instantly share code, notes, and snippets.

@erkattak
Last active July 20, 2017 20:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save erkattak/aa8818f06ef3a1f2854714406a639e18 to your computer and use it in GitHub Desktop.
Save erkattak/aa8818f06ef3a1f2854714406a639e18 to your computer and use it in GitHub Desktop.
Odd Connect

POST /api/connections

Request

curl -X POST \
  https://oddconnect.com/api/connections \
  -H 'accept: application/json' \
  -H 'authorization: bearer your-org-token-here' \
  -H 'content-type: application/json' \
  -d '{
	"data": {
		"type": "connection",
		"attributes": {
			"email": "foo@example.com",
			"device_urn": "dev:123"
		}
	}
}'

Error Response

Status: 400, 401, 403, 422

Format:

{
	"errors": [
		{
			"title": "Bad Request",
			"status": "400",
			"detail": "Invalid/malformed request"
		}
	]
}

Success Response

Status: 201

{
	"jsonapi": {
		"version": "1.0"
	},
	"data": {
		"type": "connection",
		"id": "ecf96bde-42e0-46a5-9e30-bd641250b6e2",
		"attributes": {
			"organization_urn": "your-org-urn",
			"expires_at": "2017-05-03T02:25:42Z",
			"email": "foo@example.com",
			"device_urn": "dev:123"
		}
	}
}

GET /api/connections/:id

Request

curl -X GET \
  https://oddconnect.com/api/connections/ecf96bde-42e0-46a5-9e30-bd641250b6e2 \
  -H 'accept: application/json' \
  -H 'authorization: bearer your-org-token-here' \
  -H 'content-type: application/json'

Error Response

Status: 400, 401, 403, 422

Format:

{
	"errors": [
		{
			"title": "Bad Request",
			"status": "400",
			"detail": "Invalid/malformed request"
		}
	]
}

Success Response

Status: 200

{
	"jsonapi": {
		"version": "1.0"
	},
 	"data": {
		"type": "connection",
		"id": "ecf96bde-42e0-46a5-9e30-bd641250b6e2",
		"attributes": {
			"verified_at": "2017-05-03T02:21:42",
			"jwt": "a-jwt-for-your-connection",
			"organization_urn": "your-org-urn",
			"email": "foo@example.com",
			"device_urn": "dev:123"
		}
	}
}

GET /api/device_users/:email

Request

curl -X GET \
  https://oddconnect.com/api/device_users/foo@example.com \
  -H 'accept: application/json' \
  -H 'authorization: bearer your-org-token-here' \
  -H 'content-type: application/json'

Error Response

Status: 400, 401, 403, 422

Format:

{
	"errors": [
		{
			"title": "Bad Request",
			"status": "400",
			"detail": "Invalid/malformed request"
		}
	]
}

Success Response

Status: 200

{
	"jsonapi": {
		"version": "1.0"
	},
 	"data": {
		"type": "device_user",
		"id": "ecf96bde-42e0-46a5-9e30-bd641250b6e2",
		"attributes": {
			"email": "foo@example.com"
		}
	}
}

POST /api/device_users/:email/transactions

Request

curl -X POST \
  https://oddconnect.com/api/device_users/foo@example.com/transactions \
  -H 'accept: application/json' \
  -H 'authorization: bearer your-org-token-here' \
  -H 'content-type: application/json' \
  -d '{
	"data": {
		"type": "transaction",
		"attributes": {
			"platform": "ROKU",
			"roku_product_id": "xxxxx",
			"roku_transaction_id": "yyyyy-yyyyyy-yyyyyyy-yyyyyyyy",
			"receipt": {
				"roku_field": "roku_value"
			}
		}
	}
}'

Error Response

Status: 400, 401, 403, 422

Format:

{
	"errors": [
		{
			"title": "Bad Request",
			"status": "400",
			"detail": "Invalid/malformed request"
		}
	]
}

Success Response

Status: 201

{
	"jsonapi": {
		"version": "1.0"
	},
	"data": {
		"type": "transaction",
		"id": "ecf96bde-42e0-46a5-9e30-bd641250b6e2",
		"attributes": {
			"urn": "urn:roku:transaction:yyyyy-yyyyyy-yyyyyyy-yyyyyyyy",
			"platform": "ROKU",
			"invalidated_at": null,
			"receipt": {
				"roku_field": "roku_value"
			},
			"email": "foo@example.com",
			"entitlement_urn": "whatever:your:entitlement:urn:is",
			"product_urn": "urn:roku:product:xxxxx"
		}
	}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment