JReviews logo Docs
Menu
Version

REST API

Use the REST API addon to integrate with web services and unleash the power of JReviews beyond your website.

Demo

Below you can see a little directory app that uses the API with our JReviews demo site. The app was developed using Ionic Vue.

We've made the source code available for free on Github. → Get the code. We are not providing support for building or integrating with existing mobile apps. The code is shared as is to be used as a reference.

Our demo refreshes periodically so if the app doesn't load, try waiting a bit and then re-load the page.

To sign-in to the app use:

Getting Started

The first step to get started with the JReviews REST API is to create the JReviews REST API menu. This will be used as the base URL for all endpoints. For example, if the slug for the REST API menu is directory-api and you want to get a list of listings via the /jreviews/listings endpoint, the URL would be:

https://jreviews.com/directory-api/jreviews/listings

Authentication

The API uses Bearer tokens to authenticate existing site users. API requests that create or modify data must include the Bearer token in the Authorization header.

Once you have a token, using it in the Authorization header for read-only requests allows obtaining user-specific information. For example:
• Permissions letting you know if the user can update, delete, or add media to an object.
• Information about whether a listing is in the user's favorites.

This is useful when building an app because it allows you to incorporate this information into the UI/UX without having to perform additional requests.

Create User Account

Register a new user account. This endpoint uses basic core Joomla and WordPress functionality for user registration.

Payload Parameters

name required
User's Full Name
username required
User's username
email required
Account email
password required
Account password
device optional
Allows specifying a string identifier for the device used to register which can be associated with the generated user token on successful registration.

Returns

If user accounts are automatically activated, the request returns a user object with Bearer token to use in Authorization header in subsequent requests. Otherwise a pending_activation status is returned.

In WordPress all accounts are automatically activated. In Joomla it depends on the site's configuration.

request
post /jreviews/auth/register
response
// Automatic activation

{
    "id": 100,
    "avatar": "",
    "email": "",
    "name": "",
    "token": ""
}

// Pending activation

{
    "status": "pending_activation",
    "message": "User successfully registered. Needs to be activated using email activation link."
}

Connect User

Retrieve the user token to use in requests requiring authentication, and also non-authenticated requests that will provide more user-specific information like permissions.

Payload Parameters

email required
User's email
password required
User's password
device optional
Allows specifying a string identifier for the device used to login
request
post /jreviews/auth/email
response
{
    "id": 100,
    "avatar": "",
    "email": "",
    "name": "",
    "token": ""
}

Logout User

Log out the user by invalidating the token.

Parameters

No parameters

request
Header Authorization: Bearer USER_TOKEN_HERE
required
get /jreviews/auth/logout
response
{
    "message": "Successfully logged out"
}

Listings

Listings can be pretty much anything you want (products, news, services, businesses, people, etc.) and they each belong to one category.

Create Listing

Create a listing.

Payload Parameters

title required
Listing title
summary optional
Listing summary/description
dir_id required
Directory ID
cat_id required
Category ID
criteria_id required
Listing type ID
request
Header Authorization: Bearer USER_TOKEN_HERE
required
post /jreviews/listings
response
{
    "id": 123,
    "title": "New Listing",
    "slug": "new-listing",
    "created": "2024-01-15 10:30:00",
    "url": "https://example.com/listings/new-listing"
}

Get Listing

Get a single listing.

Parameters

No parameters

request
get /jreviews/listings/:id
response
{
    "id": 123,
    "title": "Sample Listing",
    "summary": "Listing description",
    "fields": {},
    "media": [],
    "permissions": {
        "can_edit": true,
        "can_delete": false
    }
}

Update Listing

Update a listing.

Payload Parameters

title optional
Updated listing title
summary optional
Updated summary/description
request
Header Authorization: Bearer USER_TOKEN_HERE
required
patch /jreviews/listings/:id
response
{
    "id": 123,
    "title": "Updated Listing",
    "updated": "2024-01-15 11:00:00"
}

List Listings

Get a list of listings.

Parameters

No parameters

request
get /jreviews/listings
response
{
    "data": [
        {
            "id": 123,
            "title": "Listing 1"
        },
        {
            "id": 124,
            "title": "Listing 2"
        }
    ],
    "pagination": {
        "total": 50,
        "per_page": 10,
        "current_page": 1
    }
}

Delete Listing

Delete a listing.

Parameters

No parameters

request
Header Authorization: Bearer USER_TOKEN_HERE
required
delete /jreviews/listings/:id
response
{
    "message": "Listing deleted successfully"
}

Comments

Create Comment

Create a listing comment which can include ratings if these are setup for the listing type.

Payload Parameters

comments required
Comment text
rating optional
Overall rating (if enabled for listing type)
request
Header Authorization: Bearer USER_TOKEN_HERE
required
post /jreviews/listings/:id/comments
response
{
    "id": 456,
    "comments": "Great place!",
    "rating": 5,
    "created": "2024-01-15 12:00:00"
}

Get Comment

Get a single comment.

Parameters

No parameters

request
get /jreviews/comments/:id
response
{
    "id": 456,
    "comments": "Great place!",
    "rating": 5,
    "author": {
        "id": 100,
        "name": "John Doe"
    },
    "created": "2024-01-15 12:00:00",
    "permissions": {
        "can_edit": true,
        "can_delete": false
    }
}

Update Comment

Update a comment.

Payload Parameters

comments optional
Updated comment text
rating optional
Updated rating (if enabled for listing type)
request
Header Authorization: Bearer USER_TOKEN_HERE
required
patch /jreviews/comments/:id
response
{
    "id": 456,
    "comments": "Updated comment!",
    "rating": 4,
    "updated": "2024-01-15 13:00:00"
}

List Comments

Get a list of comments.

Parameters

No parameters

request
get /jreviews/comments
response
{
    "data": [
        {
            "id": 456,
            "comments": "Great place!",
            "rating": 5
        },
        {
            "id": 457,
            "comments": "Nice service",
            "rating": 4
        }
    ],
    "pagination": {
        "total": 100,
        "per_page": 10,
        "current_page": 1
    }
}

List Listing Comments

Get a list of comments for a specific listing.

Parameters

No parameters

request
get /jreviews/listings/:id/comments
response
{
    "data": [
        {
            "id": 456,
            "comments": "Great place!",
            "rating": 5,
            "author": {
                "id": 100,
                "name": "John Doe"
            },
            "created": "2024-01-15 12:00:00"
        }
    ],
    "pagination": {
        "total": 25,
        "per_page": 10,
        "current_page": 1
    }
}

Delete Comment

Delete a comment.

Parameters

No parameters

request
Header Authorization: Bearer USER_TOKEN_HERE
required
delete /jreviews/comments/:id
response
{
    "message": "Comment deleted successfully"
}

Media

Listing owners can upload photos and attachments to their listings.

Upload Photo to Listing

Only the listing owner is allowed to upload photos to the listing.

Payload Parameters

photo required
Photo file to upload (multipart/form-data)
request
Header Authorization: Bearer USER_TOKEN_HERE
required
Header Content-Type: multipart/form-data
required
post /jreviews/listings/:id/photo
response
{
    "id": 789,
    "url": "https://example.com/media/photo.jpg",
    "thumbnail": "https://example.com/media/photo-thumb.jpg"
}

Upload Attachment to Listing

Only the listing owner is allowed to upload attachments to the listing.

Payload Parameters

attachment required
Attachment file to upload (multipart/form-data)
request
Header Authorization: Bearer USER_TOKEN_HERE
required
Header Content-Type: multipart/form-data
required
post /jreviews/listings/:id/attachment
response
{
    "id": 790,
    "url": "https://example.com/media/document.pdf",
    "filename": "document.pdf"
}

Delete Media

Delete a photo or attachment.

Parameters

No parameters

request
Header Authorization: Bearer USER_TOKEN_HERE
required
delete /jreviews/media/:id
response
{
    "message": "Media deleted successfully"
}

Listing Favorites

Favorite Listing

Parameters

No parameters

request
Header Authorization: Bearer USER_TOKEN_HERE
required
post /jreviews/listings/:id/favorite
response
{
    "message": "Listing added to favorites"
}

Unfavorite Listing

Parameters

No parameters

request
Header Authorization: Bearer USER_TOKEN_HERE
required
delete /jreviews/listings/:id/favorite
response
{
    "message": "Listing removed from favorites"
}

Me

Read or perform actions specific to the authenticated user.

Get Authenticated User

Get the authenticated user information.

Parameters

No parameters

request
Header Authorization: Bearer USER_TOKEN_HERE
required
get /jreviews/me
response
{
    "id": 100,
    "name": "John Doe",
    "email": "[email protected]",
    "avatar": "https://example.com/avatars/john.jpg"
}

Delete User Account

Delete the user's account.

Parameters

No parameters

request
Header Authorization: Bearer USER_TOKEN_HERE
required
delete /jreviews/me
response
{
    "message": "User account deleted successfully"
}

Get Authenticated User Listings

Get list of listings submitted by the authenticated user.

Parameters

No parameters

request
Header Authorization: Bearer USER_TOKEN_HERE
required
get /jreviews/me/listings
response
{
    "data": [
        {
            "id": 123,
            "title": "My Listing",
            "created": "2024-01-10 10:00:00"
        }
    ],
    "pagination": {
        "total": 5,
        "per_page": 10,
        "current_page": 1
    }
}

Get Authenticated User Favorites

Get list of favorites for the authenticated user.

Parameters

No parameters

request
Header Authorization: Bearer USER_TOKEN_HERE
required
get /jreviews/me/favorites
response
{
    "data": [
        {
            "id": 456,
            "title": "Favorite Listing",
            "created": "2024-01-12 14:30:00"
        }
    ],
    "pagination": {
        "total": 12,
        "per_page": 10,
        "current_page": 1
    }
}

Users

Get User Profile

Get a user's public profile.

Parameters

No parameters

request
get /jreviews/users/:id
response
{
    "id": 100,
    "name": "John Doe",
    "avatar": "https://example.com/avatars/john.jpg",
    "listings_count": 15
}

Field Options

Get Field Options

Get a complete list of options for a given field.

Parameters

No parameters

request
get /jreviews/fields/:name/options
response
{
    "field": "category",
    "options": [
        {"value": "1", "text": "Option 1"},
        {"value": "2", "text": "Option 2"}
    ]
}

Search Field Options

Search a field's options.

Payload Parameters

q required
Search query
request
get /jreviews/fields/:name/search
response
{
    "field": "category",
    "results": [
        {"value": "1", "text": "Matching Option"}
    ]
}

API Limitations

Only the documented endpoints are currently supported. JReviews has a very large number of features developed over 15 years. This means it will be difficult for the API to reach feature parity anytime soon.

At this time many existing website settings and functionality are not connected to the API. For example, the following is a small subset of features/implementations that are not-functional in the API:

  • Automated titles generated when creating a listing
  • Video and audio uploads
  • Email notifications
  • Hooks
  • Guest submissions
  • Custom field PHP output formatting