openactive-archive / opportunity-api

Repository for the Opportunity API specification
0 stars 0 forks source link

Partial responses #3

Open nickevansuk opened 6 years ago

nickevansuk commented 6 years ago

Use Case

For mobile device usecases, a restricted number of fields returned enables the implementer to minimise data transfer.

References

Proposal

The fields keyword is reserved to allow for the restriction of properties returned in the response.

/sessions?fields=name,startDate,subEvent[1].startDate,subEvent[1].endDate

Examples

/sessions?fields=name,activity,location.address,offers.name,offers.price,offers.priceCurrency

  "items": [
    {
      "name": "Example Leisure Centre Table Tennis",
      "activity": "Table Tennis",
      "location": {
        "address": {
          "type": "PostalAddress",
          "streetAddress": "1 High Street",
          "addressLocality": "Bristol",
          "postalCode": "BS1 4SD"
        }
      },
      "offers": [
        {
          "name": "30 minute hire",
          "price": "10",
          "priceCurrency": "GBP"
        },
        {
          "name": "60 minute hire",
          "price": "10",
          "priceCurrency": "GBP"
        }
      ]
   }
 ]

/sessions?fields=name,activity,location.address.postalCode,offers[1].price,offers[1].priceCurrency,offers[2].name

  "items": [
    {
      "name": "Example Leisure Centre Table Tennis",
      "activity": "Table Tennis",
      "location": {
        "address": {
          "postalCode": "BS1 4SD"
        }
      },
      "offers": [
        {
          "name": "30 minute hire",
          "price": "10",
          "priceCurrency": "GBP"
        },
        {
          "name": "60 minute hire"
        }
      ]
   }
 ]
lukehesluke commented 6 years ago

@nickevansuk this looks good to me but have the following thoughts: