LATEST VERSION: 9.2.0 - CHANGELOG
Pivotal GemFire® v9.2

POST /gemfire-api/v1/{region}?key=<key>

Create (put-if-absent) data in region.

Resource URL

http://<hostname_or_http-service-bind-address>:<http-service-port>/gemfire-api/v1/{region}?key=<key>

Parameters

Parameter Description Example Values
key Optional. If you do not specify a key in the URL, a key will automatically be generated for you. 123

myOrder

Example Request

Request Payload: application/json
POST /gemfire-api/v1/orders?key=2

Accept: application/json
Content-Type: application/json
{
    "@type":  "org.apache.geode.web.rest.domain.Order",
     "purchaseOrderNo": 112,
     "customerId": 1012,
     "description":  "Purchase Order for myCompany",
     "orderDate":  "02/10/2014",
     "deliveryDate":  "02/20/2014",
     "contact":  "John Doe",
     "email":  "John.Doe@example.com",
     "phone":  "01-2048096",
     "totalPrice": 225,
     "items": [
        {
             "itemNo": 1,
             "description":  "Product2, PartA",
             "quantity": 10,
             "unitPrice": 5,
             "totalPrice": 50
        },
        {
             "itemNo": 2,
             "description":  "Product2, PartB",
             "quantity": 20,
             "unitPrice": 20,
             "totalPrice": 400
        }
    ]
}

Example Success Response

Response Payload: null
201 CREATED
Location: http://localhost:8080/gemfire-api/v1/orders/2

Error Codes

Status Code Description
400 BAD REQUEST Returned if JSON content is malformed.
404 NOT FOUND Returned if the specified region does not exist.
409 CONFLICT Returned if the provided key already exists in the region.
500 INTERNAL SERVER ERROR Error encountered at GemFire server. Check the HTTP response body for a stack trace of the exception.

Example Error Response

409 Conflict
Location:http://localhost:8080/gemfire-api/v1/orders/2
Content-Type: application/json

{
     "purchaseOrderNo": 112,
     "customerId": 1012,
     "description":  "Purchase Order for myCompany",
     "orderDate":  "02/10/2014",
     "deliveryDate":  "02/20/2014",
     "contact":  "John Doe",
     "email":  "John.Doe@example.com",
     "phone":  "01-2048096",
     "totalPrice": 225,
     "items": [
        {
             "itemNo": 1,
             "description":  "Product2, PartA",
             "quantity": 10,
             "unitPrice": 5,
             "totalPrice": 50
        },
        {
             "itemNo": 2,
             "description":  "Product2, PartB",
             "quantity": 20,
             "unitPrice": 20,
             "totalPrice": 400
        }
    ]
}