< Previous | Contents | Next >

2 Getting Started with REST

Let’s begin with some simple example programs. Our aim is to familiarize you with the basic methods of storing and retrieving data on HCP. We want to quickly get you to the point where you can start writing useful applications.

Studying examples is usually the best way to start. If you’re already familiar with the HCP REST API, you can skip this section and proceed directly to Section 3: Planning Your Application.


The examples in this section are written in the Java programming language and use Apache HTTP Client, an open source HTTP library.


A helpful tool when using Apache for development is to enable wire and context logging. This is strongly recommended to see exactly what is being passed to and from HCP. In order to enable logging add the following to your JVM process arguments.


-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog


-Dorg.apache.commons.logging.simplelog.showdatetime=true


-Dorg.apache.commons.logging.simplelog.log.org.apache.http=DEBUG


-Dorg.apache.commons.logging.simplelog.log.org.apache.http.wire=ERROR


 

2.1 Creating an Object2.1.1 Using a HCP Namespace2.1.2 Interpreting Responses2.2 Retrieving an Object2.2.1 Using a Namespace2.2.2 Interpreting Responses2.3 Deleting an Object2.3.1 Using a Namespace2.3.2 Interpreting Responses2.4 Working with Conditionals2.4.1 Conditionals2.4.2 Available Headers2.5 Working with System Metadata2.5.1 Available Properties2.5.2 Overriding Defaults2.5.3 Adjusting Values2.5.4 Interpreting Responses2.6 Working with Custom Metadata2.6.1 Valid Formats2.6.2 Creating Custom Metadata2.6.3 Retrieving Custom Metadata2.6.4 Deleting Custom Metadata