Comments (2)
Are there any examples of how to use this API for a beginner like myself? I could really use the help!
from trefle-api.
As someone who's just gotten started with Trefle, there's not much to getting started:
1- create an account to get your "Access token"
2- then review the documentation to determine the url to use to get the information you want
For example:
Once you have your access token you can use it directly in your browser url bar like so:
https://trefle.io/api/species?q=achillea%20borealis&token=YOUR-TOKEN-HERE
This will get you a JSON string of all results that match Achillea borealis.
To get more details on Achillea borealis, you have to look through the resulting string and find the specific plant id that you want. In this example, the id for the main_species is 101927 so you can then run the query:
https://trefle.io/api/plants/101927?token=YOUR-TOKEN-HERE
To get more detailed results specific for Achillea borealis.
I have a Chrome extension installed that makes it easier to view the resulting json string: https://chrome.google.com/webstore/detail/jsonview/chklaanhfefbnpoihckbnefhakgolnmc
To really use this data for a lot of plants you need to develop an app of some sort. I'm working in Javascript to loop through a number of plants, get the data I want and then store it on my side for future display (so I don't have to keep querying the api).
In my case of using javascript fetch rather than the browser, I have to run a terminal command every few hours so that Trefle will allow my app access to the data:
curl -i -X POST "https://trefle.io/api/auth/claim?token=YOUR-TOKEN-HERE"
Then my fetch url (for Achillea borealis) becomes:
https://trefle.io/api/species?q=achillea%20borealis&token=TOKEN-RETRIEVED-FROM-CURL-QUERY
Hope that helps you get started. That's about all I've figured out so far.
from trefle-api.
Related Issues (20)
- Is the API still working? HOT 1
- Missing Plant Info - Hoya Carnosa Compacta HOT 2
- Update to Calendar
- Certificate expired
- Add ability to reset token
- Very slow query on Api::V1::PlantsController#index HOT 1
- Missing index for `species.wiki_score`
- Downloadable archive of Trefle database HOT 1
- species request causing data array to be empty HOT 3
- Not receiving all the fields in the data HOT 2
- expired SSL certificate? HOT 1
- Cert invalid when trying to access bs.floristic.org images
- Possibly inaccurate soil salinity values HOT 1
- Possibly inaccurate soil salinity values
- CORS error when calling the API from the client side with a JWT HOT 11
- Label for better filtering
- Images not found HOT 1
- Site down? HOT 1
- Empty string key in response body
- What is wrong with the API?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from trefle-api.