DirectionVR API

Comprehensive API for managing users, listings, and location-based searches

API Key Configuration

Enter your API key below to test all endpoints. You can use one of the demo keys or your own custom key.

Quick Start

Base URL: https://api.directionvr.com/api.php

Make Your First Request

Try fetching the available categories using your configured API key:

curl -X GET "https://api.directionvr.com/api.php/categories" \
  -H "X-API-Key: your_api_key_here"
Try it now:

Authentication

All API requests require authentication using an API key. Include your API key in the request header:

X-API-Key: your_api_key_here

Alternative methods:

  • Authorization Header: Authorization: Bearer your_api_key_here
  • Query Parameter: ?api_key=your_api_key_here (for testing only)

API Endpoints

Users

GET /users read_users

Retrieve all users with pagination support.

Parameters:
  • page (optional) - Page number (default: 1)
  • limit (optional) - Items per page (default: 20, max: 100)
Example Response:
{
  "status": 200,
  "message": "Success",
  "data": {
    "users": [
      {
        "id": 1,
        "email": "[email protected]",
        "name": "John Doe",
        "phone": "+1234567890",
        "creationdate": "2024-01-01 12:00:00",
        "lastactivity": "2024-01-15 10:30:00",
        "lastip": "192.168.1.1",
        "lang": "en",
        "rank": "user"
      }
    ],
    "pagination": {
      "page": 1,
      "limit": 20,
      "total": 150,
      "pages": 8
    }
  },
  "timestamp": "2024-01-15 10:30:00"
}
Try it:
GET /users/{id} read_users

Retrieve a specific user by ID.

Example Response:
{
  "status": 200,
  "message": "Success",
  "data": {
    "id": 1,
    "email": "[email protected]",
    "name": "John Doe",
    "phone": "+1234567890",
    "creationdate": "2024-01-01 12:00:00",
    "lastactivity": "2024-01-15 10:30:00",
    "lastip": "192.168.1.1",
    "lang": "en",
    "rank": "user"
  },
  "timestamp": "2024-01-15 10:30:00"
}
POST /users write_users

Create a new user account.

Required Fields:
  • email - User's email address
  • password - User's password
Optional Fields:
  • name - User's full name
  • phone - User's phone number
Example Request:
{
  "email": "[email protected]",
  "password": "securepassword123",
  "name": "Jane Smith",
  "phone": "+1987654321"
}
Try it:

Listings

GET /listings read_listings

Retrieve all active listings with pagination and filtering.

Parameters:
  • page (optional) - Page number
  • limit (optional) - Items per page
Try it:
POST /listings write_listings

Create a new listing.

Required Fields:
  • title - Listing title
Optional Fields:
  • description - Listing description
  • lat, lng - Coordinates
  • phone, phone2, tollfree - Contact numbers
  • email, website - Contact info
  • address - Physical address
  • facebook, twitter, instagram - Social media
  • aid - Account ID (owner of the listing)
Try it:

Categories

GET /categories read_listings

Get all available categories and subcategories.

Parameters:
  • include_subcategories (optional) - Include subcategories in response
Try it:

Visits

POST /visits read_listings

Record a visit to a listing and update the visit count. This endpoint tracks when someone views a listing and automatically increments the visit counter.

Required Fields:
  • listing_id - The ID of the listing being visited
  • lat - Latitude of the visitor's location
  • lng - Longitude of the visitor's location
  • lang - Language preference ('fr' or 'en')
Example Request:
{
  "listing_id": 123,
  "lat": "45.4925",
  "lng": "-75.6305",
  "lang": "fr"
}
Example Response:
{
  "status": 201,
  "message": "Visit recorded successfully",
  "data": {
    "listing_id": 123,
    "visit_recorded": true,
    "timestamp": "2024-01-15 14:30:25"
  }
}
Try it:
GET /visits read_listings

Get visit statistics for a specific listing, including the total visit count and number of visit records.

Parameters:
  • listing_id - The ID of the listing to get statistics for
Example Response:
{
  "status": 200,
  "message": "Success",
  "data": {
    "id": 123,
    "title": "Restaurant Example",
    "visits": 45,
    "visit_records": 42
  }
}
Try it:

User Authentication

POST /login No auth required

Authenticate a user with email and password to receive a JWT token for accessing user-specific endpoints.

Required Fields:
  • email - User's email address
  • password - User's password
Example Request:
{
  "email": "[email protected]",
  "password": "userpassword123"
}
Example Response:
{
  "status": 200,
  "message": "Login successful",
  "data": {
    "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...",
    "expires_at": "2024-01-16 14:30:25",
    "user": {
      "id": 1,
      "email": "[email protected]",
      "name": "John Doe",
      "rank": "user"
    }
  }
}
Try it:
GET /user/profile JWT Token Required

Get the current user's profile information using JWT authentication.

Headers Required:
  • Authorization: Bearer YOUR_JWT_TOKEN
  • or X-Auth-Token: YOUR_JWT_TOKEN
Try it:
POST /user/comments JWT Token Required

Add a comment to a listing (requires authentication).

Required Fields:
  • listing_id - The ID of the listing to comment on
  • comment - The comment text
Try it:
POST /user/favorites JWT Token Required

Add a listing to user's favorites (requires authentication).

Required Fields:
  • listing_id - The ID of the listing to favorite
Try it:
POST /user/logout JWT Token Required

Logout and invalidate the current JWT token.

Try it:

Error Codes

Status Code Description Common Causes
200 Success Request completed successfully
201 Created Resource created successfully
400 Bad Request Invalid request data, missing required fields
401 Unauthorized Missing or invalid API key
403 Forbidden Insufficient permissions for this action
404 Not Found Resource not found or invalid endpoint
405 Method Not Allowed HTTP method not supported for this endpoint
409 Conflict Resource already exists (e.g., duplicate email)
429 Too Many Requests Rate limit exceeded
500 Internal Server Error Server-side error, database connection issues