FLOIP / flow-results

Open specification for the exchange of "Results" data generated by mobile platforms using the "Flow" paradigm
6 stars 2 forks source link

Follow REST norms for updating package definitions via the API (Versioning system Option 2) #29

Open markboots opened 6 years ago

markboots commented 6 years ago

The current spec uses POST to /flow-results/packages both to create an initial package definition, and to create a new version of a package (when observing Option 2 for versioning). In the latter case, it posts a package with an existing id but a new modified.

This deviates from REST norms that would use POST for create and PUT for updates to a defined URL.

The JSONApi requirement defined in Updating Resources (http://jsonapi.org/format/#crud-updating) is to use PATCH for updates.

Proposal:

Adhere to JSONApi by introducing a new endpoint:

PATCH /flow-results/packages/{uuid}

for updating a package definition with a new version.

@ukanga @nditada thoughts?

nditada commented 6 years ago

👍 on PATCH for updates.

ukanga commented 6 years ago

:+1: on PATCH

markboots commented 6 years ago

Agreed on the call today:

Ona expects to receive the whole package.

See example for JSONApi patch here:


Content-Type: application/vnd.api+json
Accept: application/vnd.api+json

{
  "data": {
    "type": "packages",
    "id": "[id]",
    "attributes": {
      // full package goes here
    }
  }
}```
markboots commented 6 years ago

[Ona production update earliest Wednesday]

ukanga commented 6 years ago

@markboots just confirmed that PATCH will work in the current Ona production, we have the support already.

markboots commented 6 years ago

Awesome, thanks for the update!

jory-viamo commented 6 years ago

Successfully POSTed then PATCHed an update to Ona. Looks great!