envato-api-request
This projects helps you to make HTTP requests to the Envato API.
Installation
npm i envato-api-request
Usage
First you must require the package into your module. Note that the package exports a function which is used for setting your personal token and user agent.
Be sure to replace the two variables.
TOKEN
is the secret token you retrieved from https://build.envato.com/my-apps.USERNAME
is a description of your script only visible to the Envato API team.
// Import packageconst EnvatoAPI = // Inisialisasi personal tokenconst envato = // getTotalItemsenvato
Methods
Each method is detailed at https://build.envato.com/api/. All parameter names are the same, and should be passed inside an object.
Envato Market Catalog
getCatalogCollection(params)
Look up a public collection: Returns details of, and items contained within, a public collection
envato
getLookSingleItem(id)
Look up a single item: Returns all details of a particular item on Envato Market
// Envato Item IDlet itemId = 2833226 envato
getCatalogItemVersion(params)
Look up a wordpress theme/plugin version: Returns the latest available version of a theme/plugin. This is the recommended endpoint for Wordpress theme/plugin authors building an auto-upgrade system into their item that needs to check if a new version is available. This public endpoint doesn't require a token.
envato
getSearchItem(params)
Search for items: envato
getSearchComment(params)
Search for comments: envato
getSearchMoreLikeThis(params)
Search more like this: envato
getPopular()
Popular items by site: Returns the popular files for a particular site. Requires a site parameter, e.g. popular:themeforest
envato
getCategories(params)
Categories by site Lists the categories of a particular site. Requires a site parameter, e.g. themeforest
envato
getItemPrices(params)
Prices for a particular item: Return available licenses and prices for the given item ID
envato
getNewFiles(params)
New items by site and category: New files, recently uploaded to a particular site. Requires site and category parameters, e.g. new-files:themeforest,site-templates or new-files:graphicriver,graphics
envato
getFeatures(params)
Find featured items Shows the current site features.
envato
getRandomNewFiles(params)
Random new items: Shows a random list of newly uploaded files from a particular site (i.e. like the homepage). Requires a site parameter, e.g. random-new-files:themeforest
envato
User Details
getUser(params)
User account details Shows username, country, number of sales, number of followers, location and image for a user. Requires a username, e.g. collis
envato
getUserBadges(params)
List a user's badges: Shows a list of badges for the given user
envato
getUserItemsBySite(params)
A user's items by site: Show the number of items an author has for sale on each site. Requires a username, e.g. collis
envato
getNewFilesFromUser(params)
New Items by user: Shows up to 1000 newest files uploaded by a user to a particular site. Requires username and site parameters, e.g. new-files-from-user:collis,themeforest
envato
Envato Market Stats
getTotalUsers()
Total Envato Market users: Shows the total number of subscribed users to Envato Market
envato
getTotalItems()
Total Envato Market items: Shows the total number of items available on Envato Market
envato
getNumberOfFiles(params)
Number of files in category: Shows the number of files in the major categories of a particular site. Requires a site parameter, e.g. number-of-files:themeforest
envato
Return
Each method will return a Promise which will resolve with the parsed JSON object or reject with an error. The output is not modified, so the output is the same as on build.envato.com.
envato // or envato
Errors
The error.message
property will contain the following under these circumstances:
- Bad Request when invalid parameters are sent or required parameters are missing.
Unauthorized
when the personal token is invalid.Access Denied
when you've reached your rate limit or are banned.Not Found
when no matches or results were found by the endpoint.Internal Server Error
when the API is experiencing problems.Request Error: <message>
when there's an error executing the HTTP request.- Timeout errors
- Connection errors
- SSL errors
Error code <000>: <message>
when another HTTP code is received than those above.