LATEST VERSION: 8.0.0 - CHANGELOG
Pivotal GemFire® v8.0

POST /gemfire-api/v1/functions/{functionId}

POST /gemfire-api/v1/functions/{functionId}

Execute GemFire function on entire cluster or on a specified region, members and member groups.

Resource URL

/gemfire-api/v1/functions/{functionId}?[&onRegion=regionname|&onMembers=member1,member2,...,memberN|&onGroups=group1,group2,...,groupN]

Parameters

Parameter Description  
{functionId} Required. The name of the function to execute. AddFreeItemToOrders
onRegion Optional. Specify the target region for the function. You can only invoke a function on a single region. onRegion=regionname
onMembers Optional. Specify the target members of the function. For multiple members, specify a comma-delimited list of member names. onMembers=member1,member2
onGroups Optional. Specify the target members of the function. For multiple members, specify a comma-delimited list of member group names. onGroups=membergroup1,membergroup2
function arguments Passed in the request body (JSON). The content of the args can depend on how the function is defined. Use @type to declare argument types and @value for specifying a scalar value. For example:
[
        {
             "@type":  "double",
             "@value": 210
        },
        {
             "@type":  "com.gemstone.gemfire.web.rest.domain.Item",
             "itemNo":  "599",
             "description":  "Part X Free on Bumper Offer",
             "quantity":  "2",
             "unitprice":  "5",
             "totalprice":  "10.00"
        }
]

Example Requests

Request Payload: application/json
POST /gemfire-api/v1/functions/AddFreeItemToOrders
Accept: application/json
Content-Type: application/json

[
        {
             "@type":  "double",
             "@value": 210
        },
        {
             "@type":  "com.gemstone.gemfire.web.rest.domain.Item",
             "itemNo":  "599",
             "description":  "Part X Free on Bumper Offer",
             "quantity":  "2",
             "unitprice":  "5",
             "totalprice":  "10.00"
        }
]
Another example:
Request Payload: null

POST /gemfire-api/v1/functions/getDeliveredOrders
Accept: application/json

Example Success Responses

Response Payload: null
200 OK
Location:http: //localhost:8080/gemfire-api/v1/functions/AddFreeItemToOrders
Another example response:
Response Payload: application/json

200 OK
Content-Length: 316
Content-Type: application/json
Location: http://localhost:8080/gemfire-api/v1/functions/getDeliveredOrders
[
    {
         "purchaseOrderNo":  "1121",
         "deliveryDate":  "Thu Feb 20 00:00:00 IST 2014"
    },
    {
         "purchaseOrderNo":  "777",
         "deliveryDate":  "Thu Feb 20 00:00:00 IST 2014"
    },
    {
        ...
    }
]

Error Codes

Status Code Description
500 INTERNAL SERVER ERROR Error encountered at GemFire server. Check the HTTP response body for a stack trace of the exception.
  • The Region identified by name (%1$s) could not found!
  • Could not found the specified members in disributed system!
  • no member(s) are found belonging to the provided group(s)!
  • Disributed system does not contain any valid data node to run the specified function!
  • Key is of an inappropriate type for this region!
  • Specified key is null and this region does not permit null keys!
  • Server has encountered low memory condition!
  • Input parameter is null!
  • Could not convert function results into Restful (JSON) format!
  • Function has returned results that could not be converted into Restful (JSON) format!
  • Server has encountered an error while processing function execution!