Playstory API Reference
Introduction
Welcome to the PlayStory API! You can use our API to access PlayStory API endpoints, which can get information on campaigns, prospects and more.
We have language bindings in Shell, and JavaScript! You can view code examples in the dark area to the right, and you can switch the programming language of the examples with the tabs in the top right.
Authentication
To authorize, use this code:
# With shell, you can just pass the correct header with each request
curl "api_endpoint_here" \
-H "Authorization: your_playstory_key"
var axios = require("axios");
var config = {
method: "get",
url: "api_endpoint_here",
headers: {
Authorization: "your_playstory_key",
},
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Make sure to replace
your_playstory_key
with your API key.
PlayStory uses API keys to allow access to the API. You can register a new PlayStory API key from api page.
PlayStory expects for the API key to be included in all API requests to the server in a header that looks like the following:
Authorization: your_PlayStory_key
Projects
Get All Projects
curl --location --request GET 'https://api.playstory.io/api/projects' \
--header 'Authorization: your_playstory_key'
var axios = require("axios");
var qs = require("qs");
var data = qs.stringify({});
var config = {
method: "get",
url: "https://api.playstory.io/api/projects",
headers: {
Authorization: "your_playstory_key",
},
data: data,
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
The above command returns JSON structured like this:
{
"success": true,
"data": [
{
"_id": "id_here",
"user_id": "user_id_here",
"company_id": "company_id_here",
"project_name": "My First PlayStory Project",
"thumbnail": "thumbnail_here",
"created_date": 1654760346643,
"deleted": false,
"playstory_count": 0,
"project_view_count": 36,
"project_play_count": 4,
"clips": [],
"__v": 0
}
],
"total": 1
}
This endpoint retrieves all projects.
HTTP Request
GET https://api.playstory.io/api/projects
You will receive data for each of the playstory you have access to.
Playstory
Get Playstory Answers
curl --location --request GET 'https://api.playstory.io/api/playstories/playstory_id/answers?offset=1&limit=20' \
--header 'Authorization: your_playstory_key'
var axios = require("axios");
var config = {
method: "get",
url: "https://api.playstory.io/api/playstories/playstory_id/answers?offset=1&limit=20",
headers: {
Authorization: "your_playstory_key",
},
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
This endpoint retrieves all projects.
HTTP Request
GET https://api.playstory.io/api/playstories/playstory_id/answers?offset=1&limit=20
You will get this playstory_id
from the url of this link
https://run.playstory.io/playstory/playstory_id
URL Parameters
Parameter | Description |
---|---|
playstory_id | ID will be retrived inside the url of playstories you created |
Query Parameters
Parameter | Default | Description |
---|---|---|
offest | 1 | Offest in numbers |
limit | max | To limit the answers, in numbers |
Projects Playstories
curl --location --request GET 'https://api.playstory.io/api/projects/project_id' \
--header 'Authorization: your_playstory_key'
var axios = require("axios");
var config = {
method: "get",
url: "https://api.playstory.io/api/projects/project_id",
headers: {
Authorization: "your_playstory_key",
},
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
HTTP Request
GET https://api.playstory.io/api/projects/project_id
The project_id
will be found in the url of this link
https://run.playstory.io/projects/project_id
URL Parameters
Parameter | Description |
---|---|
project_id | ID will be retrived inside the url of projects you created |
Single Playstory
curl --location --request GET 'https://api.playstory.io/api/playstories/playstory_id' \
--header 'Authorization: your_playstory_key'
var axios = require("axios");
var config = {
method: "get",
url: "https://api.playstory.io/api/playstories/playstory_id",
headers: {
Authorization: "your_playstory_key",
},
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
This endpoint retrieves a single playstory.
HTTP Request
GET https://api.playstory.io/api/playstories/playstory_id
You will get this playstory_id
from the url of this link
https://run.playstory.io/playstory/playstory_id
URL Parameters
Parameter | Description |
---|---|
playstory_id | ID will be retrived inside the url of playstories you created |
The above command returns JSON with buch of data which all the information about the specific playstory.
Errors
The PlayStory API uses the following error codes:
Error Code | Meaning |
---|---|
400 | Bad Request -- Your request is invalid. |
401 | Unauthorized -- Your API key is wrong. |
403 | Forbidden -- The resource requested is hidden for administrators only. |
404 | Not Found -- The specified resource could not be found. |
405 | Method Not Allowed -- You tried to access a PlayStory with an invalid method. |
406 | Not Acceptable -- You requested a format that isn't json. |
429 | Too Many Requests -- You're requesting too many PlayStory's! Slow down! |
500 | Internal Server Error -- We had a problem with our server. Try again later. |
503 | Service Unavailable -- We're temporarily offline for maintenance. Please try again later. |