Sketch API v1.0.0
Api of the sketch's Fastify server in Nodejs.
You are viewing REST API documentation. This documentation is auto-generated from a swagger specification which itself is generated from annotations in the source code of the project. It is possible that this documentation includes bugs and that code samples are incomplete or wrong.
Authentication
- HTTP Authentication, scheme: bearer
sketch
Sketch requests
Create a new sketch
PUT http://localhost:5555/api/sketch HTTP/1.1
Host: localhost:5555
Content-Type: application/json
Accept: application/json
Request body
{
"userId": "string",
"userEndpointId": "string"
}
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
body | body | object | false | none |
» userId | body | string | false | none |
» userEndpointId | body | string | false | none |
Responses
Overview
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | A new sketch was created | Inline |
Response Schema
Status Code 200
A new sketch was created
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
» sketchId | string | false | none | none |
Examples
200 Response
{
"sketchId": "string"
}
To perform this operation, you must be authenticated by means of one of the following methods: bearerAuth
Code samples
- Shell
- Go
- Node
- Java
- Python
- Ruby
curl -X PUT http://localhost:5555/api/sketch \
-H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer {access-token}'
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
var body []byte
// body = ...
req, err := http.NewRequest("PUT", "http://localhost:5555/api/sketch", bytes.NewBuffer(body))
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
const fetch = require('node-fetch');
const input = '{
"userId": "string",
"userEndpointId": "string"
}';
const headers = {
'Content-Type': 'application/json', 'Accept': 'application/json', 'Authorization': 'Bearer {access-token}'
}
fetch('http://localhost:5555/api/sketch', {
method: 'PUT',
body: input,
headers
})
.then(r => r.json())
.then((body) => {
console.log(body)
})
// This sample needs improvement.
URL obj = new URL("http://localhost:5555/api/sketch");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("PUT");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream())
);
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.put(
'http://localhost:5555/api/sketch',
params={},
headers = headers)
print r.json()
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.put 'http://localhost:5555/api/sketch',
params: {}, headers: headers
p JSON.parse(result)
Join an existing sketch
PUT http://localhost:5555/api/sketch/{id} HTTP/1.1
Host: localhost:5555
Content-Type: application/json
Accept: application/json
Request body
{
"userId": "string",
"userEndpointId": "string"
}
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
id | path | string | true | sketch id |
body | body | object | false | none |
» userId | body | string | false | none |
» userEndpointId | body | string | false | none |
Responses
Overview
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Successfully joined sketch | Inline |
404 | Not Found | Sketch not found | Inline |
409 | Conflict | User has already joined the sketch | Inline |
Response Schema
Status Code 200
Successfully joined sketch
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
» sketchId | string | false | none | none |
» version | integer | false | none | none |
Status Code 404
Sketch not found
Name | Type | Required | Restrictions | Description |
---|
Status Code 409
User has already joined the sketch
Name | Type | Required | Restrictions | Description |
---|
Examples
200 Response
{
"sketchId": "string",
"version": 0
}
To perform this operation, you must be authenticated by means of one of the following methods: bearerAuth
Code samples
- Shell
- Go
- Node
- Java
- Python
- Ruby
curl -X PUT http://localhost:5555/api/sketch/{id} \
-H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer {access-token}'
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
var body []byte
// body = ...
req, err := http.NewRequest("PUT", "http://localhost:5555/api/sketch/{id}", bytes.NewBuffer(body))
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
const fetch = require('node-fetch');
const input = '{
"userId": "string",
"userEndpointId": "string"
}';
const headers = {
'Content-Type': 'application/json', 'Accept': 'application/json', 'Authorization': 'Bearer {access-token}'
}
fetch('http://localhost:5555/api/sketch/{id}', {
method: 'PUT',
body: input,
headers
})
.then(r => r.json())
.then((body) => {
console.log(body)
})
// This sample needs improvement.
URL obj = new URL("http://localhost:5555/api/sketch/{id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("PUT");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream())
);
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.put(
'http://localhost:5555/api/sketch/{id}',
params={},
headers = headers)
print r.json()
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.put 'http://localhost:5555/api/sketch/{id}',
params: {}, headers: headers
p JSON.parse(result)
Broadcast operations of a sketch
POST http://localhost:5555/api/sketch/{id} HTTP/1.1
Host: localhost:5555
Content-Type: application/json
Accept: application/json
Request body
{
"userId": "string",
"userEndpointId": "string",
"version": 0,
"payload": {
"events": [
{}
],
"target": {
"userId": "string",
"userEndpointId": "string"
}
}
}
Parameters
Parameter | In | Type | Required | Description |
---|---|---|---|---|
id | path | string | true | sketch id |
body | body | object | true | none |
» userId | body | string | true | none |
» userEndpointId | body | string | true | none |
» version | body | integer | false | none |
» payload | body | object | true | none |
»» events | body | [object] | true | none |
»» target | body | object | false | none |
»»» userId | body | string | false | none |
»»» userEndpointId | body | string | false | none |
Responses
Overview
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Successfully updated sketch | Inline |
403 | Forbidden | Forbidden | Inline |
404 | Not Found | Sketch not found | Inline |
Response Schema
Status Code 200
Successfully updated sketch
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
» sketchId | string | false | none | none |
» version | integer | false | none | none |
Status Code 403
Forbidden
Name | Type | Required | Restrictions | Description |
---|
Status Code 404
Sketch not found
Name | Type | Required | Restrictions | Description |
---|
Examples
200 Response
{
"sketchId": "string",
"version": 0
}
To perform this operation, you must be authenticated by means of one of the following methods: bearerAuth
Code samples
- Shell
- Go
- Node
- Java
- Python
- Ruby
curl -X POST http://localhost:5555/api/sketch/{id} \
-H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer {access-token}'
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Content-Type": []string{"application/json"},
"Accept": []string{"application/json"},
"Authorization": []string{"Bearer {access-token}"},
}
var body []byte
// body = ...
req, err := http.NewRequest("POST", "http://localhost:5555/api/sketch/{id}", bytes.NewBuffer(body))
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
const fetch = require('node-fetch');
const input = '{
"userId": "string",
"userEndpointId": "string",
"version": 0,
"payload": {
"events": [
{}
],
"target": {
"userId": "string",
"userEndpointId": "string"
}
}
}';
const headers = {
'Content-Type': 'application/json', 'Accept': 'application/json', 'Authorization': 'Bearer {access-token}'
}
fetch('http://localhost:5555/api/sketch/{id}', {
method: 'POST',
body: input,
headers
})
.then(r => r.json())
.then((body) => {
console.log(body)
})
// This sample needs improvement.
URL obj = new URL("http://localhost:5555/api/sketch/{id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream())
);
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
import requests
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer {access-token}'
}
r = requests.post(
'http://localhost:5555/api/sketch/{id}',
params={},
headers = headers)
print r.json()
require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer {access-token}'
}
result = RestClient.post 'http://localhost:5555/api/sketch/{id}',
params: {}, headers: headers
p JSON.parse(result)