Yii Framework Forum: RESTful API forgotten URI options - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

RESTful API forgotten URI options

#1 User is offline   dubby 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 171
  • Joined: 10-February 09
  • Location:Melbourne, Australia

Posted 31 July 2017 - 06:13 AM

Hi all,

It's been some time since I've developed an API in Yii2 but I'm now trying to remember how to query or implement what I think is builtin options in an API but I can't seem to find them now so I'm unsure.

Is there an option to query multiple records with the standard detail request like `GET /users/1,2,3` to list these three users.

Also I kind of remember you could add related models in the URL that you want to include in the response. For example, if by default user.posts is not included in the user response, you could optionally include in the request like `GET /users/1?with=posts`.

Is this right? I'm trying it and searching Google but not finding them.
0

#2 User is offline   samdark 

  • Having fun
  • Yii
  • Group: Yii Dev Team
  • Posts: 5,184
  • Joined: 17-January 09
  • Location:Russia

Posted 01 August 2017 - 03:14 PM

There is no option to get multiple records via IDs yet. https://github.com/y...ii2/issues/4478

Related models are included via "expand", not via "with".
Yii 2.0 Development Cookbook

Enjoying Yii? Star us at github

Support me so I can work more on Yii: https://www.patreon.com/samdark
0

#3 User is offline   dubby 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 171
  • Joined: 10-February 09
  • Location:Melbourne, Australia

Posted 01 August 2017 - 05:42 PM

Excellent. I got it. Thanks for the reply.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users