NAV
shell php javascript

Introduction

Welcome to the JuiceDB API! You can use our API to access JuiceDB API endpoints, which can get information on various juices, businesses and reviews in our database.

You can view code examples in the dark area to the right, and you can switch the programming language of the examples with the tabs in the top right.

Authentication

# With shell, you can just pass the correct header with each request
curl "api_endpoint_here"
  -H "Authorization: Bearer your-api-key"
<?php
$options = array(
  "http" => array(
    "method" => "GET",
    "header" => "Authorization: Bearer your-api-key"
  )
);

$context = stream_context_create($options);
$file = file_get_contents("https://api.juicedb.com", false, $context);
var_dump($file);
var request = require('request');
request.get({
  url: "https://api.juicedb.com",
  headers : {
    "Authorization": "Bearer your-api-key"
  }
}, function(error, response, body) {
  console.log('body : ', body);
});

Make sure to replace your-api-key with your API key.

The JuiceDB API uses API keys to allow access to the API. You can register a new JuiceDB API key at on your JuiceDB.com account page.

The API expects for the API key to be included in all API requests to the server in a header that looks like the following:

Authorization: Bearer your-api-key

Businesses

Get a specific business’ reviews

curl "https://api.juicedb.com/business/1/reviews"
  -H "Authorization: Bearer your-api-key"
<?php
$options = array(
  "http" => array(
    "method" => "GET",
    "header" => "Authorization: Bearer your-api-key"
  )
);

$context = stream_context_create($options);
$file = file_get_contents("https://api.juicedb.com/business/1/reviews", false, $context);
var_dump($file);
var request = require('request');
request.get({
  url: "https://api.juicedb.com/business/1/reviews",
  headers : {
    "Authorization": "Bearer your-api-key"
  }
}, function(error, response, body) {
  console.log('body : ', body);
});

The above command returns JSON structured like this:

{
  "id": 1,
  "name": "Heather's Heavenly Vapes",
  "_links": {
    "self": {
      "href": "https://api.juicedb.com/business/1"
    },
    "www": {
      "href": "https://www.juicedb.com/business/1"
    },
    "curies": [
      {
        "href": "https://apidoc.juicedb.com/#api-{rel}",
        "name": "jdb",
        "templated": true
      }
    ],
    "jdb:reviews": {
      "href": "https://api.juicedb.com/business/1/reviews"
    }
  },
  "_embedded": {
    "jdb:reviews": [
      { [reviewObject] },
      { [reviewObject] },
      { [reviewObject] },
      { [reviewObject] },
      { [reviewObject] },
    ]
  }
}

Request reviews associated to a specific business by it’s unique ID.

HTTP Request

GET /business/:id/reviews/:page

Query Parameters

Parameter Type Description
id Integer Unique ID of Juice
page Integer (Optional) Requested page number

Response Fields

Field Type Description
_links bject Container for relevant to the review
_embedded Object Container for embedded objects
_embedded[‘jdb:reviews’] Object[] Array of reviews objects
id Integer Incremental ID
name tring Name of the Business

Juices

Get a specific juice’s reviews

curl "https://api.juicedb.com/juice/1/reviews"
  -H "Authorization: Bearer your-api-key"
<?php
$options = array(
  "http" => array(
    "method" => "GET",
    "header" => "Authorization: Bearer your-api-key"
  )
);

$context = stream_context_create($options);
$file = file_get_contents("https://api.juicedb.com/juice/1/reviews", false, $context);
var_dump($file);
var request = require('request');
request.get({
  url: "https://api.juicedb.com/juice/1/reviews",
  headers : {
    "Authorization": "Bearer your-api-key"
  }
}, function(error, response, body) {
  console.log('body : ', body);
});

The above command returns JSON structured like this:

{
  "_links": {
    "self": {
      "href": "https://api.juicedb.com/juice/1"
    },
    "www": {
      "href": "https://www.juicedb.com/juice/1"
    },
    "curies": [
      {
        "href": "https://apidoc.juicedb.com/#api-{rel}",
        "name": "jdb",
        "templated": true
      }
    ],
    "jdb:reviews": {
      "href": "https://api.juicedb.com/juice/1/reviews"
    }
  },
  "_embedded": {
    "jdb:brand": { [businessObject] },
    "jdb:reviews": [
      { [reviewObject] },
      { [reviewObject] },
      { [reviewObject] },
      { [reviewObject] },
      { [reviewObject] }
    ]
  },
  "id": 1,
  "name": "Pirate's Booty (Purity)"
}

Request reviews associated to a specific juice by it’s unique ID.

HTTP Request

GET /juice/:id/reviews/:page

Query Parameters

Parameter Type Description
id Integer Unique ID of Juice
page Integer (Optional) Requested page number

Response Fields

Field Type Description
_links bject Container for relevant to the review
_embedded Object Container for embedded objects
_embedded[‘jdb:brand’] Object A business object for the maker of the product
_embedded['jdb:reviews’] Array Array of reviews objects
id Integer Incremental ID
name tring Name of the juice

Reviews

Get recent reviews

curl "https://api.juicedb.com/reviews"
  -H "Authorization: Bearer your-api-key"
<?php
$options = array(
  "http" => array(
    "method" => "GET",
    "header" => "Authorization: Bearer your-api-key"
  )
);

$context = stream_context_create($options);
$file = file_get_contents("https://api.juicedb.com/reviews", false, $context);
var_dump($file);
var request = require('request');
request.get({
  url: "https://api.juicedb.com/reviews",
  headers : {
    "Authorization": "Bearer your-api-key"
  }
}, function(error, response, body) {
  console.log('body : ', body);
});

The above command returns JSON structured like this:

{
  "_links": {
    "self": {
      "href": "https://api.juicedb.com/reviews"
    },
    "www": {
      "href": "https://www.juicedb.com/reviews"
    },
    "curies": [
      {
        "href": "https://apidoc.juicedb.com/#api-{rel}",
        "name": "jdb",
        "templated": true
      }
    ]
  },
  "_embedded": {
    "jdb:reviews": [
      { [reviewObject] },
      { [reviewObject] },
      { [reviewObject] },
      { [reviewObject] },
      { [reviewObject] }
    ]
  }
}

Requests most recent reviews submitted to JuiceDB.com

HTTP Request

GET /reviews

Query Parameters

Parameter Type Description
page Integer (Optional) Requested page number

Response Fields

Field Type Description
_links bject Container for relevant to the review
_embedded Object Container for embedded objects
_embedded[‘jdb:reviews’] Array Array of reviews objects

Get a specific review

curl "https://api.juicedb.com/review/1"
  -H "Authorization: Bearer your-api-key"
<?php
$options = array(
  "http" => array(
    "method" => "GET",
    "header" => "Authorization: Bearer your-api-key"
  )
);

$context = stream_context_create($options);
$file = file_get_contents("https://api.juicedb.com/review/1", false, $context);
var_dump($file);
var request = require('request');
request.get({
  url: "https://api.juicedb.com/review/1",
  headers : {
    "Authorization": "Bearer your-api-key"
  }
}, function(error, response, body) {
  console.log('body : ', body);
});

The above command returns JSON structured like this:

{
    "_embedded": {
        "jdb:subject": { [juiceObject or businessObject] },
        "jdb:user": { [userObject] }
    },
    "body": "I'm currently on my 3rd bottle of Pirate's Booty and it's in my ADV rotation. I really enjoy the subtle flavor of coffee or caramel with the spiced tobacco flavor. I've ordered another 2x 50ml bottles of this juice to make sure I have it on hand, steeped, and ready for a good long while :)",
    "flavors": [
        "rich",
        "spiced",
        "tobacco"
    ],
    "id": 1,
    "rating": {
        "score": 4,
        "vapor": 3,
        "hit": 4,
        "value": 4,
        "flavor": 4
    },
    "_links": {
        "self": {
            "href": "http://local.api.juicedb.com/review/1"
        },
        "www": {
            "href": "http://local.www.juicedb.com/review/1"
        },
        "curies": [
            {
                "href": "http://local.apidoc.juicedb.com/#api-{rel}",
                "name": "jdb",
                "templated": true
            }
        ]
    }
}

Requests most recent reviews submitted to JuiceDB.com

HTTP Request

GET /reviews

Query Parameters

Parameter Type Description
page Integer (Optional) Requested page number

Response Fields

Field Type Description
_links Object Container for relevant to the review
_embedded Object Container for embedded objects
_embedded['jdb:business’] Array The subject of the review (business reviews only)
_embedded['jdb:juice’] Array The subject of the review (juice reviews only)
_embedded['jdb:user’] Array Embedded uesr which is the author of this review
id Integer Incremental ID
body String Body/content of review
flavors String[] Array of flavor tags (juice reviews only)
rating Object User ratings for this review
rating.score Integer Overall Score (1 - 5)
rating.flavor Integer Flavor Accuracy (1 - 5)
rating.hit Integer Throat Hit (1 - 5)
rating.value Integer Value (1 - 5)
rating.vapor Integer Cloud Production (1 - 5)

Search

curl "https://api.juicedb.com/search/juice/berry"
  -H "Authorization: Bearer your-api-key"
<?php
$options = array(
    "http" => array(
        "method" => "GET",
        "header" => "Authorization: Bearer your-api-key"
    )
);

$context = stream_context_create($options);
$file = file_get_contents("https://api.juicedb.com/search/juice/berry", false, $context);
var_dump($file);
var request = require('request');
request.get({
    url: "https://api.juicedb.com/search/juice/berry",
    headers : {
        "Authorization": "Bearer your-api-key"
    }
}, function(error, response, body) {
    console.log('body : ', body);
});

The above command returns JSON structured like this:

{
    "_links": {
        "self": {
            "href": "http://local.api.juicedb.com/search/juice"
        },
        "www": {
            "href": "http://local.www.juicedb.com/search/juice"
        },
        "curies": [
            {
                "href": "http://local.apidoc.juicedb.com/#api-{rel}",
                "name": "jdb",
                "templated": true
            }
        ]
    },
    "_embedded": {
        "jdb:juices": [
          { [juiceObject] },
          { [juiceObject] },
          { [juiceObject] },
          { [juiceObject] },
          { [juiceObject] }
        ]
    }
}

Search for a document by type and either name or ID

HTTP Request

GET /search/:type/:query

Query Parameters

Parameter Type Description
type String Type of document to query
Allowed values: business, juice
query String Name, partial name or ID of documents to search

Response Fields

Field Type Description
_links Object Container for relevant to the review
_embedded Object Container for embedded objects
_embedded[‘jdb:juices’] Array Array of juice objects
_embedded['jdb:businesses’] Array Array of business objects