🤖

API Documentation

 

Introduction

A REST API to retrieve trend data, powered by Treendly.com
Rate limit: 60 requests per minute.
For any tech issues, just reach out to: mike@treendly.com

Base URL

The base URL for all API requests is:
https://treendly.com/api

Authorization

All POST requests must be authorized by passing the following parameters to the request:
  • uid (required) (int): your API user id
  • password (required) (var): your API password
 

Endpoints

POST /quick-get

Returns a quick analysis of a term.

Parameters

  • term (required) (int): The maximum number of books to return. The default is 10.
  • geo (optional) (var): Two-letter code of a country. The default is US.
  • view (optional) (int): 1 or 5. Returns a 1-year or 5-year time series of the trend data. The default value is 5.

Response

Returns a JSON object with the following properties:
  • attributes
    • trend
      • average
      • pace
      • pace_type
  • trend: A time series of the trend data

Example

Request:
POST /quick-get?term=coronavirus&geo=US
Response:
{
	"code": 1,
	"status": 200,
	"data": "Success",
	"attributes": 
	{
			"trend": 
			{
					"average": 3.5,
					"pace": 2,
					"pace_type": 0
			}
	},
	"trend": 
	[
			{
					"time": "1531008000",
					"value": 0
			}, 
			{
					"time": "1531612800",
					"value": 0
			}, 
			{
					"time": "1532217600",
					"value": 0
			}, 
			{
					"time": "1532822400",
					"value": 0
			}, 
			..
	]
}
 

Errors

This API uses the following error codes:
  • 400 Bad Request: The request was malformed or missing the required parameters.
  • 401 Unauthorized: The API key provided was invalid or missing.
  • 403 Forbidden: The API key provided was invalid or missing.
  • 404 Not Found: The requested resource was not found.
  • 424 Failed dependency: One of our partners is down.
  • 500 Internal Server Error: An unexpected error occurred on the server.