Lesson05 Getting Started With IBM Cloudant Script
Lesson05 Getting Started With IBM Cloudant Script
Lesson05 Getting Started With IBM Cloudant Script
Cloudant Query uses mongo-style querying and is useful for ad-hoc queries, when using many logical
operators, or if you are familiar with querying data using MongoDB or SQL.
The Cloudant web site includes examples and tutorials for each type of index to help you get started. If
you sign in, then you will be able to add any of the sample databases to your Cloudant account.
This process uses the replication API under the covers to replicate the selected sample database to your
dashboard. You can create as many databases as you need in your account each with any number of
documents.
The next time you load your dashboard, youll see the animaldb sample database in your list of databases.
The animaldb database includes a design document defining any secondary indexes that the database
should have. And the rest of the documents contain the information for each animal.
Cloudant leverages an HTTP API with the API URL giving you direct programmatic access from an
application or from the command line with the cURL utility. From here, you can also view the JSON
document at the specified URL.
The Cloudant HTTP API follows this hierarchical model.
Account
Database
Document
Attachment
A URL for the Cloudant API is made up of an account name, the database within that account, and the
endpoints to manipulate data within that database.
This example references the ablanks account, the employee_directory database, and for all documents in
the database, show the document body. You could use this programmatically to populate a web page that
shows all employees.
You make HTTP requests using these verbs:
GET
PUT
POST
DELETE
COPY
Typically, when you access the data from a browser, you perform a GET; however, you can use browser
add-on tools or a command line tool to PUT, POST, DELETE, or COPY data.
You can use the API to perform all of these requests:
Insert data
Read data
Create indexes
Make queries
Monitor the database
Create replication jobs
Or Create databases
Heres what an HTTP API command looks like.
The first part indicates that this is an HTTP request.