private ResponseEntity<?> create(String region, String key, String json,
      boolean keyInQueryParam) {
    logger.debug("Create JSON document ({}) in Region ({}) with Key ({})...", json, region, key);

    Object existingPdxObj;

    // Check whether the user has supplied single JSON doc or Array of JSON docs
    final JSONTypes jsonType = validateJsonAndFindType(json);
    if (JSONTypes.JSON_ARRAY.equals(jsonType)) {
      existingPdxObj = postValue(region, key, convertJsonArrayIntoPdxCollection(json));
    } else {
      existingPdxObj = postValue(region, key, convert(json));
    }

    final HttpHeaders headers = new HttpHeaders();
    if (keyInQueryParam) {
      headers.setLocation(toUriWithKeys(new String[] {encode(key)}, region));
    } else {
      headers.setLocation(toUri(region, key));
    }

    if (existingPdxObj != null) {
      final RegionEntryData<Object> data = new RegionEntryData<>(region);
      data.add(existingPdxObj);
      headers.setContentType(APPLICATION_JSON_UTF8);
      return new ResponseEntity<RegionEntryData<?>>(data, headers, HttpStatus.CONFLICT);
    } else {
      return new ResponseEntity<>(headers, HttpStatus.CREATED);
    }
  }
Creating entry into the region

@param region region name where data will be created
@param key gemfire region key
@param json JSON document that is stored against the key
@return JSON document
geode-web-api/src/main/java/org/apache/geode/rest/internal/web/controllers/PdxBasedCrudController.java