Links
Not recommended for production usage!
The API is currently not meant for public usage. There are no API keys available and endpoints might change unexpectedly with the release of a new version.
Use the API to add links to your WebCrate instance or to interact with existing ones.
Links can be accessed with the API under /api/link
.
Adding links
You can add new link by sending a POST
request with the URL you want to add:
POST https://webcrate.username.deta.app/api/link
Body:
{
"url": "https://piedpiper.com/"
}
{
"status": 200,
"message": "ok",
"data": {
"id": "8N5f1z8rBWussD7G",
"url": "https://piedpiper.com/",
"crate": "null",
"meta": {
"icon": "https://s3.amazonaws.com/assets.piedpiper.pro/app/uploads/2018/03/pp_favicon_72.ico.png",
"title": "Pied Piper"
},
"redirect": {
"enabled": false
},
"addedWith": "web",
"addedAt": "2021-08-03T12:55:37.245Z"
}
}
To a crate
By default all links will be added to the inbox. You can also specify the ID of a crate to add the link directly to it:
POST https://webcrate.username.deta.app/api/link
Body:
{
"url": "https://piedpiper.com/",
"crate": "id"
}
{
"status": 200,
"message": "ok",
"data": {
"id": "8N5f1z8rBWussD7G",
"url": "https://piedpiper.com/",
"crate": "id",
"meta": {
"icon": "https://s3.amazonaws.com/assets.piedpiper.pro/app/uploads/2018/03/pp_favicon_72.ico.png",
"title": "Pied Piper"
},
"redirect": {
"enabled": false
},
"addedWith": "web",
"addedAt": "2021-08-03T12:55:37.245Z"
}
}
Getting links
Use the GET
method to retrieve one or more links. For multiple links, the data key holds an array of link objects ordered by when they were added, with the newest at the top.
A single link object will be in the following format:
{
"id": "a5UCD31aX95JI1iR",
"url": "https://piedpiper.com/",
"crate": "YndwZAUFgYuFkNMI",
"meta": {
"icon": "https://s3.amazonaws.com/assets.piedpiper.pro/app/uploads/2018/03/pp_favicon_72.ico.png",
"title": "Pied Piper",
"description": "Over the years, Pied Piper has changed many landscapes. Compression. Data. The Internet."
},
"redirect": {
"enabled": false
},
"addedWith": "web",
"addedAt": "2021-08-03T12:57:34.221Z"
}
All links
Send a GET
request to the link endpoint to get all links:
GET https://webcrate.username.deta.app/api/link
{
"status": 200,
"message": "ok",
"last": "a5UCD31aX95JI1iR",
"data": [
{
"id": "a5UCD31aX95JI1iR",
"url": "https://piedpiper.com/",
"crate": "null",
"meta": {
"icon": "https://s3.amazonaws.com/assets.piedpiper.pro/app/uploads/2018/03/pp_favicon_72.ico.png",
"title": "Pied Piper"
},
"redirect": {
"enabled": false
},
"addedWith": "web",
"addedAt": "2021-08-03T12:57:34.221Z"
}
]
}
By default links are paginated and limited to 20 links per page. Use the pagination parameters to control this and get the next page of links.
By id
You can also get an individual link by specifying it's id as the url parameter e.g. /api/link/:id
GET https://webcrate.username.deta.app/api/link/a5UCD31aX95JI1iR
{
"status": 200,
"message": "ok",
"data": {
"id": "a5UCD31aX95JI1iR",
"url": "https://piedpiper.com/",
"crate": "null",
"meta": {
"icon": "https://s3.amazonaws.com/assets.piedpiper.pro/app/uploads/2018/03/pp_favicon_72.ico.png",
"title": "Pied Piper"
},
"redirect": {
"enabled": false
},
"addedWith": "web",
"addedAt": "2021-08-03T12:57:34.221Z"
}
}
By crate
You can also get all links belonging to a crate by specifing the crate's id as the crate
query parameter e.g. /api/link?crate=id
:
GET https://webcrate.username.deta.app/api/link?crate=a5UCD31aX95JI1iR
{
"status": 200,
"message": "ok",
"last": "a5UCD31aX95JI1iR",
"data": [
{
"id": "a5UCD31aX95JI1iR",
"url": "https://piedpiper.com/",
"crate": "a5UCD31aX95JI1iR",
"meta": {
"icon": "https://s3.amazonaws.com/assets.piedpiper.pro/app/uploads/2018/03/pp_favicon_72.ico.png",
"title": "Pied Piper"
},
"redirect": {
"enabled": false
},
"addedWith": "web",
"addedAt": "2021-08-03T12:57:34.221Z"
}
]
}
For more ways to filter for links and crates check out the search endpoint!
Changing links
You can modify/change a link using the PUT
method. You can only modify a single link at once and need to specify it's id as the url parameter e.g. /api/link/:id
.
You need to provide a object which describes the updates as the request body:
{
"crate": "id"
}
Nested properties like
meta
andredirect
need to be accessed using the dot-notation e.g. meta.title
PUT https://webcrate.username.deta.app/api/link
Body:
{
"crate": "a5UCD31aX95JI1iR",
"redirect.shortCode": "piper",
"redirect.enabled": true,
"meta.title": "Piedpiper",
"meta.description": "Piedpiper is cool"
}
{
"status": 200,
"message": "ok",
"data": {
"id": "8N5f1z8rBWussD7G",
"url": "https://piedpiper.com/",
"crate": "a5UCD31aX95JI1iR",
"meta": {
"icon": "https://s3.amazonaws.com/assets.piedpiper.pro/app/uploads/2018/03/pp_favicon_72.ico.png",
"title": "Piedpiper",
"description": "Piedpiper is cool"
},
"redirect": {
"enabled": true,
"shortCode": "piper"
},
"addedWith": "web",
"addedAt": "2021-08-03T12:55:37.245Z"
}
}
Deleting links
If you want to delete a link, use the DELETE
method and specify it's id as the url parameter e.g. /api/link/:id
:
DELETE https://webcrate.username.deta.app/api/link/a5UCD31aX95JI1iR
{
"status": 200,
"message": "ok"
}