api-specification icon indicating copy to clipboard operation
api-specification copied to clipboard

Direct updates of subresources

Open boxfoot opened this issue 8 years ago • 2 comments

Let's say I have an organizational phone id (let's say 12345), and I want to get the whole record from the API. But I don't necessarily know the right organization id.

The format for phones is: /organizations/{orgId}/phones/{phoneId}

Is there a way for me to GET (or PUT changes) without knowing the organization id? Based on my current reading of version 1.1, there isn't. Should we add something like Google that would let me GET /organizations/-/phones/12345 for this situation?

boxfoot avatar Jul 17 '17 21:07 boxfoot

Good thoughts.

I'd say #46 and #42 contribute to the GET portion, with addition of /search?phone=

But, your approach gracefully deals with GET and POST--providing an interesting design pattern to consider.

kinlane avatar Jul 17 '17 23:07 kinlane

After the last round, my recommendation here is that sub resources also get introduced as top level resources, similar to how /services is, but more actually like /contacts is currently. I'd say services has become a top level, but /contacts is in limbo.

Example:

/contacts /phones /physical_address /mailing_address /holiday_schedule /regular_schedule/ /disabilities

Maybe even shortening:

/address /schedule

All allowing for:

  • Phone # loop
  • Address lookup
  • Who's open on holidays

Many other discovery types scenarios, rather than just wildcard. This is definitely lower priority, as there are bigger fishes to fry currently.

kinlane avatar Aug 31 '17 20:08 kinlane