-
Notifications
You must be signed in to change notification settings - Fork 3
API Documentation
These are the endpoints and functions for Tapestry's PHP back-end. Organized by functionality:
- Tapestry Functions
- Node Functions
- Link Functions
- User Functions
- Gravity Forms Functions
- H5P Functions
- Misc Functions
All functions related to entire tapestries
- Create Tapestry
- Delete Tapestry
- Get Tapestry Data
- Update Tapestry Dataset
- Update Tapestry Settings
- Create Tapestry Group (Depreciated)
Creates a new tapestry with the given nodes and links. New Tapestry's title and information is in the response settings object Response contains new ids of each node and new links between those nodes
method: POST
url: /tapestries
request: {
nodes: Array of Objects,
groups: Array of Objects,
links: Array of Objects,
title: String,
}
response: {
nodes: Array of Numbers,
groups: Array of Objects,
linkes: Array of Objects,
settings: Object,
rootId: Number
}
Deletes tapestry with given title from WordPress
method: DELETE
url: /tapestries
request: {
title: String,
}
response: none
Returns the tapestry's dataset in JSON format
method: GET
url: /tapestries/<tapestry-post-id>
response: {
nodes: Array of Objects,
groups: Array of Objects,
linkes: Array of Objects,
settings: Object,
rootId: Number
}
Replaces a tapestry's dataset with the given data Throws error if tapestry is not empty
method: PUT
url: /tapestries/<tapestry-post-id>
request: {
nodes: Array of Objects,
groups: Array of Objects,
links: Array of Objects,
}
response: {
nodes: Array of Numbers,
groups: Array of Objects,
linkes: Array of Objects,
settings: Object,
rootId: Number
}
Replaces the tapestry's settings with given data
method: PUT
url: /tapestries/<tapestry-post-id>/settings
request: {
tapestrySlug: String,
title: String,
status: String,
... Remaining fields reflect each setting
}
Depreciated
method: POST
url: /tapestries/<tapestry-post-id>/groups
- Create Tapestry Node
- Delete Tapestry Node
- Update Tapestry Node
- Update Node Permissions
- Update Node Coordinates
- Update Node Title
- Update Node Description
- Update Node Thumbnail Image URL
- Update Node Locked Thumbnail Image URL
- Update Node Type Data
- Update Tapestry Node Size (Depreciated)
Creates a new node in the DB and returns the validated info and Node ID
method: POST
url: /tapestries/<tapestry-post-id>/nodes
request: {
type: String,
... All other fields from the node creation form
}
response: {
id: Number,
author: Object,
type: String,
size: String,
... All other fields from the Node's definition in the DB
}
Removes node with matching <node-meta-id>
from DB
method: DELETE
url: /tapestries/<tapestry-post-id>/nodes/<node-meta-id>
response: Array of Node IDs
Replaces data for a specific node ID in the DB
method: PUT
url: /tapestries/<tapestry-post-id>/nodes/<node-meta-id>
request: {
type: String,
... All other fields from the node creation form
}
response: {
id: Number,
author: Object,
type: String,
size: String,
... All other fields from the Node's definition in the DB
}
Replace a node with matching <node-meta-id>
's permission object with new data
method: put
url: /tapestries/<tapestry-post-id>/nodes/<node-meta-id>/permissions
request: {
public: Array of String,
authenticated: Array of String,
... For each other role or individual ID: Array of String
}
response: {
id: Number,
author: Object,
type: String,
permissions: Object,
... All other fields from the Node's definition in the DB
}
Replace Node coordinates with new coordinates Object
method: PUT
url: /tapestries/<tapestry-post-id>/nodes/<node-meta-id>/coordinates
request: {
coordinates: {
x: Double
y: Double
}
}
response: {
id: Number,
author: Object,
type: String,
coordinates: Object,
... All other fields from the Node's definition in the DB
}
Replace Node title field with new String title
method: PUT
url: /tapestries/<tapestry-post-id>/nodes/<node-meta-id>/title
request: {
title: String
}
response: {
id: Number,
author: Object,
type: String,
title: String,
... All other fields from the Node's definition in the DB
}
Replace Node description field with new String description
method: PUT
url: /tapestries/<tapestry-post-id>/nodes/<node-meta-id>/description
request: {
description: String
}
response: {
id: Number,
author: Object,
type: String,
description: String,
... All other fields from the Node's definition in the DB
}
Replace Node image thumbnail URL field with new String URL
method: PUT
url: /tapestries/<tapestry-post-id>/nodes/<node-meta-id>/imageURL
request: {
imageURL: String
}
response: {
id: Number,
author: Object,
type: String,
imageURL: String,
... All other fields from the Node's definition in the DB
}
Replace Node locked image thumbnail URL field with new String URL
method: PUT
url: /tapestries/<tapestry-post-id>/nodes/<node-meta-id>/lockedImageURL
request: {
lockedImageURL: String
}
response: {
id: Number,
author: Object,
type: String,
lockedImageURL: String,
... All other fields from the Node's definition in the DB
}
Replace Node typeData with new typeData Object
method: PUT
url: /tapestries/<tapestry-post-id>/nodes/<node-meta-id>/typeData
request: {
typeData: Object
}
response: {
id: Number,
author: Object,
type: String,
typeData: Object,
... All other fields from the Node's definition in the DB
}
Depreciated
method: PUT
url: /tapestries/<tapestry-post-id>/nodes/<node-meta-id>/size
Creates a new link between two nodes with given Ids
method: POST
url: /tapestries/<tapestry-post-id>/links
request: {
source: Number,
target: Number,
value: 1,
type: "",
appearsAt: "",
}
response: {
source: Number,
target: Number,
value: 1,
type: "",
appearsAt: "",
}
Removes link with given id Number
method: DELETE
url: /tapestries/<tapestry-post-id>/links
request: Number
response: Array of Link Objects
- Get User Progress
- Get User Entries
- Set User's Node Progress
- Set User's Node as Complete
- Set User's Quiz Question as Complete
- Get User's H5P Settings
- Set User's H5P Settings
- Get User's Audio Submission
- Set User's Audio Submission
- Get User's Favourites
- Set User's Favourites
Retrieve all progress objects from a given tapestry
method: GET
url: /users/progress?post_id=<tapestry-post-id>
response: Array of Progress Objects
Retrieves user's responses to given node activity If no id is given, returns all entries for all activities
method: GET
url: /users/entries?node_id=<node-meta-id>
response: Array of Entry Objects
Set the progress value for a given node in a given tapestry
method: POST
url: /users/progress
request: {
node_id: Number,
post_id: Number,
progress_value: Number
}
response: None
Marks the given node in the given tapestry as complete
method: POST
url: /users/completed?post_id=<tapestry-post-id>&node_id=<node-meta-id>
response: None
Marks the given question, in the given node and tapestry, as complete
method: POST
url: /users/quiz?post_id=<tapestry-post-id>&node_id=<node-meta-id>&question_id=<question-id>
response: None
Get the current user's H5P settings for the current tapestry
method: POST
url: /users/h5psettings/<tapestry-post-id>
response: {
volume: Number,
muted: Boolean,
playbackRate: Double,
quality: String,
caption: Object
}
Save new H5P settings to database Models the interactive video player settings API
method: POST
url: /users/h5psettings/<tapestry-post-id>
request: {
volume: Number,
muted: Boolean,
playbackRate: Double,
quality: String,
caption: Object
}
response: none
Returns the base64 audio string from the server for given params
method: GET
url: /tapestries/<tapestry-post-id>/nodes/<node-meta-id>/audio/<question-id>
response: String
Save the audio submission to the server and return a link to that submission
method: POST
url: /tapestries/<tapestry-post-id>/nodes/<node-meta-id>/audio
request: {
audio: String,
questionId: String (GUID)
}
response: String
Returns a list of node id's user has marked as favorite
method: GET
url: /users/favourites?post-id=<tapestry-post-id>
response: Array of Node IDs
Takes a string representation of the current favourites list, and saves that to the DB
method: POST
url: /users/favourites?post-id=<tapestry-post-id>
request: {
favourites: String
}
response: None
Returns whether or not Gravity Forms is installed on this WordPress instance
method: GET
url: /gf/exists
response: Boolean
Returns all available Gravity Forms forms in this WordPress instance
/gf/forms
response: Array of Objects
Returns gravity form entry object following the API specs
method: GET
url: /gf/entries?form_id=<form-id>
response: Entry Object
Get the titles of all H5P content items on WP instance
method: GET
url: /h5p
response: Array of Objects with Title and IDs
Logins in user with given credentials. Returns a hash String (session ID?)
method: POST
url: /login
request: {
username: String,
password: String
}
response: String
Logs current user out
method: POST
url: /logout
response: None