9 OBJECTS OF TYPE RESOURCE

The "Object of Type" resource is the target of a persist link to persist a proto-persistent ("not yet persisted") object §A2.2 of a given domain type.

The overall process is:

  • client invokes an action that creates a proto-persistent object representation

  • client uses the "arguments" json-property of the "rel"="…​/persist" link to determine the information required

  • client obtains the required information, for example, prompting for it in a user interface

  • client posts the arguments map back to the Objects resource, with the missing information

  • assuming that the values are valid, a representation of the newly persisted domain object is returned

    • the response code is 201, and will have the Location header

    • the representation itself will now include the "self" link, the "instanceId" json-property (and the "domainType" json-property if simple scheme §A3.1.1).

The endpoint for this resource is: /objects/{domainType} where:

  • {domainType} uniquely identifies the domain type of the objects being persisted

9.1 HTTP POST

Persist a domain object by posting a cut-down version of its representation.

9.1.1 POST Request

9.1.1.1 Headers

  • Accept

    • application/json

    • application/json;profile="…​/object"

9.1.1.2 Body

Because this resource is in a sense "uploading" a new object, the body is the cut-down version of the domain object representation §C14.4 [1]. It consists of:

  • members[memberType=property]

In other words, it includes all properties and their values (including those that would normally be hidden), along with a reference to the domaintype of the object being persisted.

In addition, it may include the reserved query parameter:

  • x-ro-validate-Only

    • "true"

      • validate that the representation provided could be persisted as a new object, without actually persisting it.

For example:

{
  "members": {
    "firstName": {
      "value": ...
    },
    "lastName": {
      "value": ...
    }, ...
  }
}

9.1.2 POST Successful Response

As per §C13.2 (201), returning a domain object representation §C14.4.

9.1.3 POST Validation Only and Succeeded

9.1.3.1 Status Code

  • 204 "No content"

9.1.3.2 Headers

  • none

9.1.3.3 Body

  • none

9.1.4 POST Invalid Request

For example, if the body is malformed, or any other syntax error.

9.1.4.1 Status Code

  • 400 "bad request"

9.1.4.2 Headers

  • Warning

    • summary message – indicating the nature of the error

9.1.4.3 Body

Error representation, §B10.

9.1.5 POST Validation Failed Response

9.1.5.1 Status Code

  • 422 "unprocessable entity"

9.1.5.2 Headers

  • Warning

    • summary message

9.1.5.3 Body

Body is the same as that posted, but indicating the properties that were invalid, with a reason in each case.

For example:

{
  "members": {
    "firstName": {
      "value": "Joe"
    }, {
      "lastName": {
      "value": null,
      "invalidReason": "Mandatory"
    },
    ...
  }
}

1. Note that this is different from the body provided to PUT Object §C14.2 used to update multiple properties.