Create database access API

  1. Click the Menu icon > Drafts.
  2. Click APIs.
  3. Click Add and then click New OpenAPI from scratch.
  4. For the name of the new API, enter weatherwatchers. Click Create API.
  5. In the Design page, click Paths.
  6. Click the + to create a new path.
  7. Set the new path to /reports.
  8. Click Add Operation and select POST.
  9. Click Add Parameter > Add new parameter.
  10. In the Name field, enter report.
  11. Click the Assemble tab.
  12. Click the Invoke icon. Enter the Cloudant REST API URL with /_all_docs?include_docs=true appended to the end, for example:
  13. Enter the API key value in the Basic Authentication Username field. Enter the API Key secret in the Basic Authentication Password field.
  14. Change the Title to Weatherwatcher reports.
  15. Save your changes. Then, click the Test arrow.
  16. Scroll down and enter Weatherwatchers for the name of a new product to contain this API. Then, click Create and publish.
  17. Click Next.
  18. Select the get /reports operation.
  19. Scroll down and click Invoke.
  20. Scroll down to verify the entire report was retrieved from the database.
  21. Close the Test page.