-
-
Notifications
You must be signed in to change notification settings - Fork 724
API documentation
This page describes Open Food Network's API.
We use swagger and json-api to document the OFN API. You can see the Documentation Here
If you want to use the API, you can access the API Handbook in the User Guide
See also Authentication
To access the API, you need an API key. This can be found in the admin
backend at the right of the edit user page. That can be passed with the
X-Spree-Token
request header, or the token
query parameter.
The user api key can be found in the OFN backoffice: click on the menu Users, select the user that will use the API, see "API KEY".
If you are not an admin of the instance you are trying to access, you will need to request your API token to an admin of that instance.
You can also fetch your API key in the html content of some pages in the BackOffice.
- Login, go to the BackOffice and load the Products page
- Open dev tools
- Search for "SpreeApiKey" in the html content: that will be your API key
Using the command line, you can use curl to get some data from the OFN API.
List all the products you can see in that particular instance:
DOMAIN can be for example http://openfoodnetwork.org.uk
API KEY can be for example 41eae622fabbc8ce3f51d5b986b87bcb94498618fe52895e
curl -X GET "http://openfoodnetwork.org.uk/api/products/bulk_products" -H "X-Spree-Token: 41eae622fabbc8ce3f51d5b986b87bcb94498618fe" -H "accept: application/json"
OR
curl -X GET "http://openfoodnetwork.org.uk/api/products/bulk_products?token=41eae622fabbc8ce3f51d5b986b87bcb94498618fe52895e" -H "accept: application/json"
If you want to improve/develop the OFN API have a look at the API development wiki page.
Development environment setup
- Pipeline development process
- Bug severity
- Feature template (epic)
- Internationalisation (i18n)
- Dependency updates
Development
- Developer Guidelines
- The process of review, test, merge and deploy
- Making a great commit
- Making a great pull request
- Code Conventions
- Database migrations
- Testing and Rspec Tips
- Automated Testing Gotchas
- Rubocop
- Angular and OFN
- Feature toggles
- Stimulus and Turbo
Testing
- Testing process
- OFN Testing Documentation (Handbooks)
- Continuous Integration
- Parallelized test suite with knapsack
- Karma
Releasing
Specific features
Data and APIs
Instance-specific configuration
External services
Design