facilityregistry / fred-api

Facility Registry API Documentation Website
11 stars 4 forks source link

Return more data on facility creation #37

Closed mwhite closed 11 years ago

mwhite commented 11 years ago

Currently the spec says that the server should return the facility URL when a facility is created. (DHIS2 does this with the Location header. This should probably be explicitly specified in the spec.)

DHIS2 also returns the URL of a human-readable page. Since there is no defined format for URLs with respect to IDs, there is no way to get the ID of a newly created facility.

The spec should be changed to either:

mortenoh commented 11 years ago

I agree. For POST/PUT we should return the updated facility as JSON.

We have a specific need for this in Uganda, where we are generating ETag to help with edit conflicts.

Morten

On Thu, Jan 31, 2013 at 11:39 PM, Mike White notifications@github.comwrote:

Currently the spec says that the server should return the facility URL when a facility is created. (DHIS2 does this with the Location header. This should probably be explicitly specified in the spec.)

DHIS2 also returns the URL in a human-readable form. Since there is no defined format for URLs with respect to IDs, there is no way to get the ID of a newly created facility.

The spec should be changed to either:

  • the URL returned must be to the JSON representation of the facility. The client can then make an additional request to get data about the new facility.
  • or better, the response body should contain the JSON representation of the core properties of the facility. This also ensures that other core properties like createdAt and updatedAt are known to the client.

    — Reply to this email directly or view it on GitHubhttps://github.com/facilityregistry/fred-api/issues/37.

mortenoh commented 11 years ago

We still want to also return the Location header of course.

On Fri, Feb 1, 2013 at 1:50 PM, Morten Olav Hansen mortenoh@gmail.comwrote:

I agree. For POST/PUT we should return the updated facility as JSON.

We have a specific need for this in Uganda, where we are generating ETag to help with edit conflicts.

Morten

On Thu, Jan 31, 2013 at 11:39 PM, Mike White notifications@github.comwrote:

Currently the spec says that the server should return the facility URL when a facility is created. (DHIS2 does this with the Location header. This should probably be explicitly specified in the spec.)

DHIS2 also returns the URL in a human-readable form. Since there is no defined format for URLs with respect to IDs, there is no way to get the ID of a newly created facility.

The spec should be changed to either:

  • the URL returned must be to the JSON representation of the facility. The client can then make an additional request to get data about the new facility.
  • or better, the response body should contain the JSON representation of the core properties of the facility. This also ensures that other core properties like createdAt and updatedAt are known to the client.

    — Reply to this email directly or view it on GitHubhttps://github.com/facilityregistry/fred-api/issues/37.

rowenaluk commented 11 years ago

+1

mortenoh commented 11 years ago

DHIS 2 have already been updated to return the body as JSON both in POST and PUT, this helps with ETag generation (which is not part of the spec, but we are using it in Uganda).

We also set the Location: header as an absolute URL, and return the code 201 Created.

Unless someone disagree, I think we should close this, and put it as part of the spec.

mberg commented 11 years ago

Mortan we discussed this specific issue on the last call and are going to do this. 201 created with location pointing to the created resource.

I'll be doing a lot of cleanup on the docs today working from. Trying to get everything up to date with the github issues.

Will be working form this (still missing a few updates like the 201, what are the required parameters in the creates etc).

http://facility-registry-api.readthedocs.org/en/latest/api_1_1.html

Will send a summary later today when this is all completed.

On Sun, Feb 3, 2013 at 9:02 AM, Morten Olav Hansen <notifications@github.com

wrote:

DHIS 2 have already been updated to return the body as JSON both in POST and PUT, this helps with ETag generation (which is not part of the spec, but we are using it in Uganda).

We also set the Location: header as an absolute URL, and return the code 201 Created.

Unless someone disagree, I think we should close this, and put it as part of the spec.

— Reply to this email directly or view it on GitHubhttps://github.com/facilityregistry/fred-api/issues/37#issuecomment-13042945.

edjez commented 11 years ago

Can be closed- obsolete

mberg commented 11 years ago

Closing for Ed