Create database access API
- Click the Menu icon > Drafts.
- Click APIs.
- Click Add and then click New OpenAPI from scratch.
- For the name of the new API, enter
weatherwatchers
. Click Create API.
- In the Design page, click Paths.
- Click the + to create a new path.
- Set the new path to
/reports
.
- Click Add Operation and select POST.
- Click Add Parameter > Add new parameter.
- In the Name field, enter
report
.
- Click the Assemble tab.
- Click the Invoke icon. Enter the Cloudant REST API URL with
/_all_docs?include_docs=true
appended to the end, for example:
https://api-key.cloudant.com/weatherwatchers/_all_docs?include_docs=true
- Enter the API key value in the Basic Authentication Username field. Enter the API Key secret in the Basic Authentication Password field.
- Change the Title to
Weatherwatcher reports
. - Save your changes. Then, click the Test arrow.
- Scroll down and enter
Weatherwatchers
for the name of a new product to contain this API. Then, click Create and publish.
- Click Next.
- Select the get /reports operation.
- Scroll down and click Invoke.
- Scroll down to verify the entire report was retrieved from the database.
- Close the Test page.