Making a POST request

In this example, you create a new Note object by calling the POST method on the Notes resource.

Before you begin

You cannot make a POST request by using a web browser, as web browsers only directly support GET requests. For this example, we assume that you have installed a REST client browser plugin. Chrome and Firefox both support open source Rest Client plugins that allow for the invocation of REST APIs from the browser.

Procedure

  1. Enter the following URL to authenticate to the Cúram server with the j_username and j_password parameters: https://<host>:<port>/Rest/j_security_check?j_username=<username>&j_password=<password
  2. Select the POST method of the https://<host>:<port>/Rest/v1/notes URL.
    Option Description
    https://<host>:<port>/Rest The context path of the URL where you can access the REST APIs.
    v1 The version of the REST API that you want to invoke.
    notes The resource you want to access.
  3. Set the following required request headers:
    Referer
    curam://foundational.app
    Content-Type
    application/json
  4. Add a JSON representation of the note to the request body. For example:
    {
      "outcome_plan_id": "106",
      "username": "planner",
      "description": "Some text",
      "title": "Some text",
      "status": {
        "value": "RST1"
      }
    }
  5. Submit the POST request.

Results

If the request is successful, you see a HTTP 201 Created response code, indicating the successful creation of the Note.

The HTTP response will contain no body content, however the response header will include a Location property, referencing the URL of the newly created note resource. For example:

Location: https://<host>:<port>/Rest/v1/notes/12345

This URL follows the same format as the POST URL, but with the additional /{note_id} path parameter added to the end. In the above example, 12345 is the unique identifier of the newly created note.

If the request is unsuccessful or if you are not logged into the Cúram server, you see a HTTP error response code.

.