-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
619 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
digraph architecture { | ||
nsq [label="NSQ" style="filled" fillcolor="skyblue1"] | ||
brainspark [label="Brainspark API" shape="egg" style="filled" fillcolor="orange"] | ||
es [label="ElasticSearch" shape="egg" style="filled" fillcolor="lightseagreen"] | ||
|
||
|
||
brainspark->nsq [label="publish\nevents"] | ||
app->nsq [label="consume\nevents"] | ||
app->es [label="index\n events"] | ||
brainspark->es [label="search &\n aggregate"] | ||
app->brainspark [label="query\n related\ndata"] | ||
|
||
subgraph clusterApp { | ||
color="lightgrey" | ||
style="filled" | ||
app [label="Your App" shape="rect" style="filled" fillcolor="gold"] | ||
|
||
app->app [label="filter &\n hydrate\n events"] | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
log: | ||
format: text | ||
level: info |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
version: '3' | ||
services: | ||
brainspark: | ||
build: | ||
context: . | ||
dockerfile: ./brainspark/Dockerfile | ||
command: --jsonrpc --seed | ||
depends_on: | ||
- nsqd | ||
ports: | ||
- "8080:8080" | ||
volumes: | ||
- ./test.yml:/etc/brainspark/config.yml | ||
environment: | ||
BRAINSPARK_NSQ_HOST: nsqd:4150 | ||
|
||
make: | ||
build: | ||
context: . | ||
dockerfile: ./Dockerfile.test | ||
command: --jsonrpc --seed | ||
depends_on: | ||
- nsqd | ||
ports: | ||
- "8080:8080" | ||
environment: | ||
BRAINSPARK_NSQ_HOST: nsqd:4150 | ||
|
||
nsqlookupd: | ||
image: nsqio/nsq | ||
command: /nsqlookupd | ||
ports: | ||
- "4160" | ||
- "4161" | ||
|
||
nsqd: | ||
image: nsqio/nsq | ||
command: /nsqd --lookupd-tcp-address=nsqlookupd:4160 | ||
depends_on: | ||
- nsqlookupd | ||
ports: | ||
- "4150:4150" | ||
- "4151:4151" | ||
|
||
nsqadmin: | ||
image: nsqio/nsq | ||
command: /nsqadmin --lookupd-http-address=nsqlookupd:4161 | ||
depends_on: | ||
- nsqlookupd | ||
ports: | ||
- "4171:4171" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Brainspark API | ||
The *BrainSpark* API is a JSON RPC 2.0 exposed over HTTP. | ||
|
||
All operations: | ||
- must use path `/` | ||
- must use http method `POST` | ||
- must include header `Content-Type: application/json` | ||
- must include a valid [JSON RPC 2.0](http://www.jsonrpc.org/specification) payload | ||
|
||
###### Example Request | ||
```http | ||
POST / HTTP/1.1 | ||
Host: {brainspark_host} | ||
Accept: application/json | ||
Content-Type: application/json | ||
{ | ||
"jsonrpc": "2.0", | ||
"method": "{service}.{method}", | ||
"id": "{request_id}", | ||
"params": { | ||
"ids": [ | ||
"599a7dba-fb3a-11e7-93d8-a7d489958da0" | ||
] | ||
} | ||
} | ||
``` | ||
|
||
## Services | ||
See below for a list of API methods grouped by service. | ||
|
||
### Account | ||
- [Account.BatchGetAccount](account-batch-get-account.md) | ||
- [Account.BatchGetUser](account-batch-get-user.md) | ||
- [Account.GetAccount](account-get-account.md) | ||
- [Account.GetUser](account-get-user.md) | ||
|
||
### Content | ||
- [Content.BatchGetCourse](content-batch-get-course.md) | ||
- [Content.GetCourse](content-get-course.md) | ||
|
||
### Participation | ||
- [Participation.BatchGetAttempt](participation-batch-get-attempt.md) | ||
- [Participation.GetAttempt](participation-get-attempt.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
[Back](README.md) | ||
|
||
### Batch Get Accounts | ||
|
||
Retrieves a set of 1 to 200 accounts by id. Missing accounts will be designated with a `null` value | ||
|
||
###### Method | ||
``` | ||
Account.BatchGetAccount | ||
``` | ||
|
||
###### Example Request | ||
```http | ||
POST / HTTP/1.1 | ||
Host: {brainsparkHost} | ||
Content-Type: application/json | ||
{ | ||
"jsonrpc": "2.0", | ||
"method": "Account.BatchGetAccount", | ||
"params": { | ||
"ids": [ | ||
"599a7dba-fb3a-11e7-93d8-a7d489958da0", | ||
"bec784b6-fb3b-11e7-9b5b-0bc91e981e31" | ||
] | ||
}, | ||
"id": "c4e0bf8a-fb3f-11e7-8241-0faf4421c718", | ||
} | ||
``` | ||
|
||
###### Example Response | ||
```http | ||
HTTP/1.1 200 OK | ||
Content-Type: application/json | ||
{ | ||
"jsonrpc": "2.0", | ||
"result": { | ||
"data": [ | ||
{ | ||
"id": "599a7dba-fb3a-11e7-93d8-a7d489958da0", | ||
"name": "foo", | ||
"domain": "foo.mindflash.com" | ||
}, | ||
{ | ||
"id": "bec784b6-fb3b-11e7-9b5b-0bc91e981e31", | ||
"name": "bar", | ||
"domain": "bar.mindflash.com" | ||
} | ||
] | ||
}, | ||
"id": "c4e0bf8a-fb3f-11e7-8241-0faf4421c718" | ||
} | ||
``` | ||
|
||
[Back](README.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
[Back](README.md) | ||
|
||
### Batch Get Users | ||
|
||
Retrieves a set of 1 to 200 users by id. Missing users will be designated with a `null` value | ||
|
||
###### Method | ||
``` | ||
Account.BatchGetUser | ||
``` | ||
|
||
###### Example Request | ||
```http | ||
POST / HTTP/1.1 | ||
Host: {brainsparkHost} | ||
Content-Type: application/json | ||
{ | ||
"jsonrpc": "2.0", | ||
"method": "Account.BatchGetUser", | ||
"params": { | ||
"ids": [ | ||
"853629b4-fb40-11e7-a26c-4b5026d382d8", | ||
"b6feec9c-fb40-11e7-89ce-374290f50084" | ||
] | ||
}, | ||
"id": "c73931e4-fb40-11e7-a95f-fb1e838d3f17" | ||
} | ||
``` | ||
|
||
###### Example Response | ||
```http | ||
HTTP/1.1 200 OK | ||
Content-Type: application/json | ||
{ | ||
"jsonrpc": "2.0", | ||
"result": { | ||
"data": [ | ||
{ | ||
"id": "853629b4-fb40-11e7-a26c-4b5026d382d8", | ||
"account_id": "21f8c490-2e26-42d0-bbc1-4d4efab6cc4d", | ||
"email": "[email protected]", | ||
"first_name": "Ashley", | ||
"last_name": "Gordon" | ||
}, | ||
{ | ||
"id": "b6feec9c-fb40-11e7-89ce-374290f50084", | ||
"account_id": "b91e575c-8ab0-4114-b11b-d7a06cdbba4f", | ||
"email": "[email protected]", | ||
"first_name": "Frances", | ||
"last_name": "Larson" | ||
} | ||
] | ||
}, | ||
"id": "c73931e4-fb40-11e7-a95f-fb1e838d3f17" | ||
} | ||
``` | ||
|
||
[Back](README.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
[Back](README.md) | ||
|
||
### Get Account | ||
|
||
Retrieves a single account by id. A missing account will be designated with a `null` value | ||
|
||
###### Method | ||
``` | ||
Account.GetAccount | ||
``` | ||
|
||
###### Example Request | ||
```http | ||
POST / HTTP/1.1 | ||
Host: {brainsparkHost} | ||
Content-Type: application/json | ||
{ | ||
"jsonrpc": "2.0", | ||
"method": "Account.GetAccount", | ||
"params": { | ||
"id": "21f8c490-2e26-42d0-bbc1-4d4efab6cc4d" | ||
}, | ||
"id": "00c56456-fb40-11e7-9ffe-4bb811edbd26" | ||
} | ||
``` | ||
|
||
###### Example Response | ||
```http | ||
HTTP/1.1 200 OK | ||
Content-Type: application/json | ||
{ | ||
"jsonrpc": "2.0", | ||
"result": { | ||
"data": { | ||
"id": "21f8c490-2e26-42d0-bbc1-4d4efab6cc4d", | ||
"created_at": "2013-05-29T08:24:48Z", | ||
"name": "Topicblab" | ||
} | ||
}, | ||
"id": "00c56456-fb40-11e7-9ffe-4bb811edbd26" | ||
} | ||
``` | ||
|
||
[Back](README.md) |
Oops, something went wrong.