PestLens API Documentation
Below are the current functions available in the PestLens API. Include your API key in each request, for example:
https://test.pestlens.info/public/api.cfc?method=getLatestNotification&apiKey=YOUR_API_KEY&returnFormat=json
Don't have your API key? Simply log in to your PestLens account and visit your profile page - you will find it listed there.
Don't have a PestLens account? Visit our registration page to create one: Registration Page
Starter Kit
Here's how to get started using the PestLens API:
1. Using a Browser
Simply paste the URL into your browser, replacing YOUR_API_KEY and the parameters as needed:
https://test.pestlens.info/public/api.cfc?method=getArticlesByCountry&apiKey=YOUR_API_KEY&countryName=Canada&returnFormat=json
2. Using Postman
- Set method to GET
- Enter URL: https://test.pestlens.info/public/api.cfc
- In the query parameters, set:
- method: getArticlesByCountry
- apiKey: YOUR_API_KEY
- countryName: Canada
- returnFormat: json
- Click Send and inspect the JSON response.
3. Using Scripts
You can also integrate the API into your own scripts. Here's a JavaScript example using jQuery:
$.ajax({
url: "https://test.pestlens.info/public/api.cfc",
type: "GET",
data: {
method: "getArticlesByCountry",
apiKey: "YOUR_API_KEY",
countryName: "Canada",
returnFormat: "json"
},
dataType: "json",
success: function(response) {
console.log(response);
},
error: function(xhr, status, error) {
console.error("API error:", error);
}
});
Or in Python using requests:
import requests
url = "https://test.pestlens.info/public/api.cfc"
params = {
"method": "getArticlesByCountry",
"apiKey": "YOUR_API_KEY",
"countryName": "Canada",
"returnFormat": "json"
}
response = requests.get(url, params=params)
data = response.json()
print(data)
Or in ColdFusion using cfhttp:
<cfset apiURL = "https://test.pestlens.info/public/api.cfc">
<cfhttp url="#apiURL#" method="get" result="apiResponse">
<cfhttpparam type="url" name="method" value="getArticlesByCountry">
<cfhttpparam type="url" name="apiKey" value="YOUR_API_KEY">
<cfhttpparam type="url" name="countryName" value="Canada">
<cfhttpparam type="url" name="returnFormat" value="json">
</cfhttp>
<cfset data = deserializeJSON(apiResponse.fileContent)>
<cfoutput>
<h3>API Response</h3>
<pre>#serializeJSON(data, true)#</pre>
</cfoutput>
This starter kit should allow you to quickly test and integrate with the PestLens API.
-
getArticlesByCountry()
Return Type: struct
Hint: Get articles filtered by country
Arguments:- apiKey (string)
- countryName (string)
-
getLatestActiveNotificationArticles()
Return Type: struct
Hint: Returns articles for the latest active notification
Arguments:- apiKey (string)
-
getArticlesByPestName()
Return Type: struct
Hint: Get articles filtered by pest name (based on GPDD Scientific Name)
Arguments:- apiKey (string)
- pestName (string)
