Otreeba
Food & DrinkGet Started with Otreeba API
Otreeba API is a public API that provides access to the most comprehensive cannabis-related data resources. It enables users to access information related to cannabis strains, products, and user reviews. The APIs are RESTful, and all the responses are either JSON or XML.
In order to get started with Otreeba API, you need to sign up for an account and obtain an API key. Once you have your API key, you’re all set to start making requests.
Sample API Requests
Below are some sample API requests that you can try out using JavaScript:
Get All Strains
fetch('https://api.otreeba.com/v1/strains', {
headers: {
'Authorization': 'Bearer YOUR_API_KEY'
}
}).then(response => response.json())
.then(data => console.log(data));
Get Strain by ID
fetch('https://api.otreeba.com/v1/strains/5f6027b50f96431c06ddf5b3', {
headers: {
'Authorization': 'Bearer YOUR_API_KEY'
}
}).then(response => response.json())
.then(data => console.log(data));
Get All Products
fetch('https://api.otreeba.com/v1/products', {
headers: {
'Authorization': 'Bearer YOUR_API_KEY'
}
}).then(response => response.json())
.then(data => console.log(data));
Get Product by ID
fetch('https://api.otreeba.com/v1/products/5f788fbc0d1405410ff8ebc8', {
headers: {
'Authorization': 'Bearer YOUR_API_KEY'
}
}).then(response => response.json())
.then(data => console.log(data));
Get User Reviews by Strain ID
fetch('https://api.otreeba.com/v1/strains/5f6027b50f96431c06ddf5b3/reviews', {
headers: {
'Authorization': 'Bearer YOUR_API_KEY'
}
}).then(response => response.json())
.then(data => console.log(data));
Conclusion
These sample API requests should give you an idea of how to get started with Otreeba API and make successful requests using JavaScript. If you’d like to explore the API further, be sure to check out the official API documentation for more information. Happy coding!