Response for a created resource - can it contain a resource identifier only?


#1

Hi,

The specification says, for “Creating Resources”, in case of a success:

The response MUST also include a document that contains the primary resource created.

Is it ok to return a resource identifier and not the full resource that was posted? I am trying to minimize the amount of data transferred over the wire here.

If YES: can it be specified more precisely in the spec?

If NO: what is the reasoning behind it and how do you address my concern of optimising resources usage by not returning the same data that was passed in?

Thanks.


#2

Is it ok to return a resource identifier and not the full resource that was posted?

I’d say YES, based on the following:
From TopLevel description

Primary data MUST be either: …

and from Creating Resources:

The response MUST also include a document that contains the primary resource created.

and

The response SHOULD include a Location header identifying the location of the newly created resource.

and from Resource Objects

A resource object MUST contain at least the following top-level members …

and

In addition, a resource object MAY contain any of these top-level members …


#3

Great, thanks for the reply.