Skip to content
This repository has been archived by the owner on Jan 17, 2025. It is now read-only.

⛔️ DEPRECATED - IBM Functions Cloudant package

Notifications You must be signed in to change notification settings

ibm-functions/package-cloudant

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This repository is no longer maintained.

IBM Cloud Functions reached end of life and this repository is no longer active.

For Apache OpenWhisk visit: https://github.com/apache/openwhisk.


Using the Cloudant package

License

The /whisk.system/cloudant package enables you to work with a Cloudant database. It includes the following actions and feeds.

Entity Type Parameters Description
/whisk.system/cloudant package dbname, host, username, password Work with a Cloudant database
/whisk.system/cloudant/read action dbname, id Read a document from a database
/whisk.system/cloudant/write action dbname, overwrite, doc Write a document to a database

Writing to a Cloudant database

You can use an action to store a document in a Cloudant database called testdb. Make sure that this database exists in your Cloudant account.

  1. Store a document by using the write action in the package binding you created previously. Be sure to replace /_/myCloudant with your package name.
wsk action invoke /_/myCloudant/write --blocking --result --param dbname testdb --param doc "{\"_id\":\"heisenberg\",\"name\":\"Walter White\"}"
ok: invoked /_/myCloudant/write with id 62bf696b38464fd1bcaff216a68b8287
{
  "id": "heisenberg",
  "ok": true,
  "rev": "1-9a94fb93abc88d8863781a248f63c8c3"
}
  1. Verify that the document exists by browsing for it in your Cloudant dashboard.

The dashboard URL for the testdb database looks something like the following: https://MYCLOUDANTACCOUNT.cloudant.com/dashboard.html#database/testdb/_all_docs?limit=100.

Reading from a Cloudant database

You can use an action to fetch a document from a Cloudant database called testdb. Make sure that this database exists in your Cloudant account.

  • Fetch a document by using the read action in the package binding that you created previously. Be sure to replace /_/myCloudant with your package name.

    wsk action invoke /_/myCloudant/read --blocking --result --param dbname testdb --param id heisenberg
    
    {
      "_id": "heisenberg",
      "_rev": "1-9a94fb93abc88d8863781a248f63c8c3",
      "name": "Walter White"
    }

About

⛔️ DEPRECATED - IBM Functions Cloudant package

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published