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

API request and response format #6

Closed markboots closed 6 years ago

markboots commented 6 years ago

Goal: develop the endpoints, format, parameters, and data flow of API access via the Flow Results spec.

System Roles: (Platforms can play multiple roles)

Actions

"Publish": A Data Collector sends new data to a Data Aggregator

POST /flow-results/packages [creates/defines a new package]

POST /flow-results/packages/[uuid]/responses

"Retrieve": A Data Consumer or another Aggregator requests data (full or paginated) from a Data Aggregator

GET /flow-results/packages - list of flow-results packages

GET /flow-results/packages/[uuid] - get the descriptor for one package

GET /flow-results/packages/[uuid]/responses - Get the data for a package

markboots commented 6 years ago

Authentication options

HEAD /flow-results/[packages|uuid/responses] for digest authentication and or Temp/Session Token

markboots commented 6 years ago

Suggestions on the call:

markboots commented 6 years ago

Do we want to use jsonapi.org for the structure of responses?

markboots commented 6 years ago
[
  [ "2017-05-23T13:35:37.356-04:00", 20394823948, 923842093, "ae54d3", "female", {"option_order": ["male","female"]} ],
  [ "2017-05-23T13:35:47.012-04:00", 20394823950, 923842093, "ae54d7", "chocolate", {} ],
  [ "2017-05-24T15:15:37.981-04:00", 20394823952, 923842086, "ae54d3", "male", {"option_order": ["male","female"]} ],
  [ "2017-05-23T15:16:12.005-04:00", 20394823953, 923842086, "ae54d7", "vanilla", {} ],
  [ "2017-05-23T15:16:20.781-04:00", 20394823954, 923842086, "ae54d8", 196, {} ],
  [ "2017-05-23T15:16:38.119-04:00", 20394823955, 923842086, "ae54da", "I am feeling curious.", {"type": "text", "language": "eng"} ],
  [ "2017-05-23T17:25:12.722-04:00", 20394823956, 923842093, "ae54da", "https://myexampleflowserver.org/resources/audio/20394823956.ogg", {"type": "audio", "language": "eng", "format": "audio/ogg"} ],
  [ "2017-05-23T17:25:47-04:00", 20394823957, 923842093, "ae54db", "[35.678323, -108.25343]", {} ]
]

In a richer JSON object that included the pagination links, like:

{
  "data": {
    "type": "flow-results-data",
    "id": "[package id]",
    "attributes": {
      responses: [
  [ "2017-05-23T13:35:37.356-04:00", 20394823948, 923842093, "ae54d3", "female", {"option_order": ["male","female"]} ],
  [ "2017-05-23T13:35:47.012-04:00", 20394823950, 923842093, "ae54d7", "chocolate", {} ],
  [ "2017-05-24T15:15:37.981-04:00", 20394823952, 923842086, "ae54d3", "male", {"option_order": ["male","female"]} ],
  [ "2017-05-23T15:16:12.005-04:00", 20394823953, 923842086, "ae54d7", "vanilla", {} ],
  [ "2017-05-23T15:16:20.781-04:00", 20394823954, 923842086, "ae54d8", 196, {} ],
  [ "2017-05-23T15:16:38.119-04:00", 20394823955, 923842086, "ae54da", "I am feeling curious.", {"type": "text", "language": "eng"} ],
  [ "2017-05-23T17:25:12.722-04:00", 20394823956, 923842093, "ae54da", "https://myexampleflowserver.org/resources/audio/20394823956.ogg", {"type": "audio", "language": "eng", "format": "audio/ogg"} ],
  [ "2017-05-23T17:25:47-04:00", 20394823957, 923842093, "ae54db", "[35.678323, -108.25343]", {} ]
]
    },
   "relationships": {
      "descriptor": {
        "links": {
          "self": "http://example.com/flow-results/packages/[uuid]/",
        },
      },
    "links": {
      "self": "http://example.com/flow-results/packages/[uuid]/responses?page[cursor]=2348723948",
      "next": "http://example.com/flow-results/packages/[uuid]/responses?page[cursor]=2348724348",
      "previous": "http://example.com/flow-results/packages/[uuid]/responses?page[cursor]=2348723348"
    }
  }
}
markboots commented 6 years ago

Completed in PR https://github.com/FLOIP/flow-results/pull/19

markboots commented 6 years ago

Closing with PR #19 .