Folders | Flextype

Folders

Rest API

The Flextype Folders API organized around Representational State Transfer (REST) for delivering folders from Flextype to apps, websites and other. Folders are delivered as JSON data.

Endpoints

Method Endpoint Description
GET /api/folders Fetch folder(folders)
POST /api/folders Create folder
PUT /api/folders Rename folder
PUT /api/folders/copy Copy folder
DELETE /api/folders Delete folder

Fetch single Folder

Request
GET /api/folders?id=YOUR_FOLDER_ID&token=YOUR_FOLDERS_TOKEN
Query
Name Description
path REQUIRED Folder path.
collection OPTIONAL Collection or single.
token REQUIRED Valid Folders Token.
Result

Returns the item object for the given unique identifier.

Examples

Fetch Movies Folder

Request
GET /api/folders?id=movies&token=6f047babd1894064fbf7662080a9a2f0

Fetch folders collection

Request
GET /api/entries?id=YOUR_FOLDER_ID&collection=true&token=YOUR_FOLDERS_TOKEN
Query
Name Description
path REQUIRED Folder path.
collection OPTIONAL Collection or single.
token REQUIRED Valid Folders Token.
Result

Returns an array of item objects.

Examples

Fetch Movies Folders Collection

Request
GET /api/folders?id=entries/movies&collection=true&token=6f047babd1894064fbf7662080a9a2f0

Create folder

Request
POST /api/folders
Body
Name Description
path REQUIRED New folder path.
token REQUIRED Valid Folders token.
access_token REQUIRED Valid Access token.
Result

Returns the folder object for the folder that was just created.

Examples

Create new folder entries/movies/platform

Request
POST /api/folders
Body
{
    "path": "entries/movies/platform",
    "token": "f3acf199a9ac120d3bfd604e1e382456",
    "access_token": "bbc4417d171e38099bd129aeca279018"
}
Response
200 OK
{
    "data": {
        "path": "entries/movies/platform",
        "full_path": "/htdocs/flextype/project/uploads/entries/movies/platform",
        "url": "project/uploads/entries/movies/platform",
        "full_url": "http://localhost:8888/flextype/project/uploads/entries/movies/platform"
    }
}

Rename folder

Request
PUT /api/folders
Body
Name Description
path REQUIRED Unique identifier of the folder.
new_path REQUIRED New Unique identifier of the folder.
token REQUIRED Valid Entries token.
access_token REQUIRED Valid Access token.
Result

Returns the folders object for the folders that was just renamed

Examples

Rename entry entries/movies/platform to the entries/movies/the-platform

Request
PUT /api/folders
Body
{
    "path": "entries/movies/platform",
    "new_path": "entries/movies/the-platform",
    "token": "f3acf199a9ac120d3bfd604e1e382456",
    "access_token": "bbc4417d171e38099bd129aeca279018"
}
Response
200 OK
{
    "data": {
        "path": "entries/movies/the-platform",
        "full_path": "/htdocs/flextype/project/uploads/entries/movies/the-platform",
        "url": "project/uploads/entries/movies/the-platform",
        "full_url": "http://localhost:8888/flextype/project/uploads/entries/movies/the-platform"
    }
}

Move entry entries/movies/the-platform to the entries/movies/2019/the-platform

Request
PUT /api/folders
Body
{
    "path": "entries/movies/the-platform",
    "new_path": "entries/movies/2019/the-platform",
    "token": "f3acf199a9ac120d3bfd604e1e382456",
    "access_token": "bbc4417d171e38099bd129aeca279018"
}
Response
200 OK
{
    "data": {
        "path": "entries/movies/2019/the-platform",
        "full_path": "/htdocs/flextype/project/uploads/entries/movies/2019/the-platform",
        "url": "project/uploads/entries/movies/2019/the-platform",
        "full_url": "http://localhost:8888/flextype/project/uploads/entries/movies/2019/the-platform"
    }
}

Copy folder

Request
PUT /api/folders/copy
Body
Name Description
path REQUIRED Unique identifier of the folder.
new_path REQUIRED New Unique identifier of the folder.
token REQUIRED Valid Folders token.
access_token REQUIRED Valid Access token.
Result

Returns the folders object for the folders that was just copied.

Examples

Copy for entry entries/movies/2019/the-platform to entries/movies/horror/the-platform

Request
PUT /api/folders/copy
Body
{
    "path": "entries/movies/2019/the-platform",
    "new_path": "entries/movies/horror/the-platform",
    "token": "f3acf199a9ac120d3bfd604e1e382456",
    "access_token": "bbc4417d171e38099bd129aeca279018"
}
Response
200 OK
{
    "data": {
        "path": "entries/movies/horror/the-platform",
        "full_path": "/htdocs/flextype/project/uploads/entries/movies/horror/the-platform",
        "url": "project/uploads/entries/movies/horror/the-platform",
        "full_url": "http://localhost:8888/flextype/project/uploads/entries/movies/horror/the-platform"
    }
}

Delete folder

Request
DELETE /api/folders
Body
Name Description
path REQUIRED Unique identifier of the folder.
token REQUIRED Valid Folders token.
access_token REQUIRED Valid Access token.
Result

Returns an empty body with HTTP status 204

Examples

Delete entry entires/movies/horror/the-platform

Request
DELETE /api/folders
Body
{
    "id": "entries/movies/horror/the-platform",
    "token": "f3acf199a9ac120d3bfd604e1e382456",
    "access_token": "bbc4417d171e38099bd129aeca279018"
}
Language: en, ru