Laravel Forum 5 Documentation

API - Threads

Threads

Endpoint paths are prefixed with the forum.router.prefix config value (/forum/api by default).

#

Fetch recent

GET /thread/recent

Returns: a collection of threads updated since forum.general.old_thread_threshold.

#

Fetch unread

GET /thread/unread

Returns: a collection of threads that are updated or unread for the authenticated user.

#

Mark as read

PATCH /thread/unread/mark-as-read

Marks the authenticated user’s unread/updated threads as read.

Returns: a generic ‘success’ response if successful.

#

Fetch

GET /thread/{id:int}

Returns: the thread specified by {id} if found and accessible, otherwise a 404 error.

#

Lock

POST /thread/{id:int}/lock

Locks the thread specified by {id}.

Returns: the updated thread object if successful.

#

Unlock

POST /thread/{id:int}/unlock

Unlocks the thread specified by {id}.

Returns: the updated thread object if successful.

#

Pin

POST /thread/{id:int}/pin

Pins the thread specified by {id}.

Returns: the updated thread object if successful.

#

Unpin

POST /thread/{id:int}/unpin

Unpins the thread specified by {id}.

Returns: the updated thread object if successful.

#

Rename

POST /thread/{id:int}/rename

Renames the thread specified by {id}. See parameter list below.

Returns: the updated thread object if successful.

Parameters

Name Type Description
title String (required) Thread title
#

Move

POST /thread/{id:int}/move

Moves the thread specified by {id}. See parameter list below.

Returns: the updated thread object if successful.

Parameters

Name Type Description
category_id Integer (required) Destination category ID
#

Delete

DELETE /thread/{id:int}

Deletes the thread specified by {id}. See parameter list below.

Returns: the deleted thread object if successful.

Parameters

Name Type Description Default
permadelete Boolean Force hard-deletion Always true if soft-deletion is disabled, otherwise false
#

Restore

POST /thread/{id:int}/restore

Restores the soft-deleted thread specified by {id}.

Returns: the restored thread object if successful.

#

Fetch posts

GET /thread/{id:int}/posts

Returns: a paginated collection of posts belonging to the thread specified by {id}.

#

Store post

POST /thread/{id:int}/posts

Creates a post in the thread specified by {id}. See parameter list below.

Returns: the created post object if successful.

Parameters

Name Type Description
content String (required) Post content
#

Bulk move

POST /bulk/thread/move

Moves a selection of one or more threads. Any threads not eligible for selection are left unchanged. See parameter list below.

Returns: a generic ‘success’ response if successful.

Parameters

Name Type Description
threads Integer array (required) IDs of threads to move
category_id Integer (required) Destination category ID
#

Bulk lock

POST /bulk/thread/lock

Locks a selection of one or more threads. Any threads not eligible for selection are left unchanged. See parameter list below.

Returns: a generic ‘success’ response if successful.

Parameters

Name Type Description
threads Integer array (required) IDs of threads to lock
#

Bulk unlock

POST /bulk/thread/unlock

Unlocks a selection of one or more threads. Any threads not eligible for selection are left unchanged. See parameter list below.

Returns: a generic ‘success’ response if successful.

Parameters

Name Type Description
threads Integer array (required) IDs of threads to unlock
#

Bulk pin

POST /bulk/thread/pin

Pins a selection of one or more threads. Any threads not eligible for selection are left unchanged. See parameter list below.

Returns: a generic ‘success’ response if successful.

Parameters

Name Type Description
threads Integer array (required) IDs of threads to pin
#

Bulk unpin

POST /bulk/thread/unpin

Unpins a selection of one or more threads. Any threads not eligible for selection are left unchanged. See parameter list below.

Returns: a generic ‘success’ response if successful.

Parameters

Name Type Description
threads Integer array (required) IDs of threads to unpin
#

Bulk delete

DELETE /bulk/thread

Deletes a selection of one or more threads. Any threads not eligible for selection are left unchanged. See parameter list below.

Returns: a generic ‘success’ response if successful.

Parameters

Name Type Description Default
threads Integer array (required) IDs of threads to delete N/A
permadelete Boolean Force hard-deletion Always true if soft-deletion is disabled, otherwise false
#

Bulk restore

POST /bulk/thread/restore

Restores a selection of one or more soft-deleted threads. Any threads not eligible for selection are left unchanged. See parameter list below.

Returns: a generic ‘success’ response if successful.

Parameters

Name Type Description
threads Integer array (required) IDs of threads to restore