Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use with id param as a endpoint #33

Open
hunglsxx opened this issue Jan 19, 2021 · 2 comments
Open

How to use with id param as a endpoint #33

hunglsxx opened this issue Jan 19, 2021 · 2 comments

Comments

@hunglsxx
Copy link

hunglsxx commented Jan 19, 2021

Hi, i have a restful api with router like: https://api.my.com/v1/users/{id}
With {id} is a value of record id.
When i use: Users::find()->where(['id' => '{id}'])->one(). It request to api like: https://api.my.com/v1/users?id={id} and my api not build router for that.
So, how can i do that without changing api router.
I am a newbie :(
Many thanks!

@hiqsol
Copy link
Member

hiqsol commented Jan 20, 2021

You need to create and use your specialized QueryBuilder with adjusted buildUri.

Like in this package:

https://github.com/hiqdev/hipanel-hiart/blob/master/src/QueryBuilder.php#L28

https://github.com/hiqdev/hipanel-hiart/blob/master/config/params.php#L13

But if you feel yourself newbie maybe hiart is overkill for you.

@hunglsxx
Copy link
Author

Yeah, awesome it's killing me. 💣
Many thanks!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants