agithub icon indicating copy to clipboard operation
agithub copied to clipboard

How to handle Api Endpoint dynamically changes

Open huynq2007 opened this issue 5 years ago • 4 comments

Hi there,

How agithub handle the endpoint which is dynamically changed as example below: api.com/rooms/{room_id}/members the room_id is a parameter which is dynamically changed.

Thank you

huynq2007 avatar Jun 15 '19 14:06 huynq2007

Yo can call it like an item like so:

YourAPIClient().rooms[room_id].members.get()

check the code here: https://github.com/mozilla/agithub/blob/4f33627de8e8b8977b83ea009692a97f08c19ac4/agithub/base.py#L78

marcoslhc avatar Jun 15 '19 18:06 marcoslhc

@marcoslhc thank you very much. It works now!

huynq2007 avatar Jun 16 '19 10:06 huynq2007

Doesn't work for me.

str(MyAPIClient().products.some_list[0]) > '/products/some_list/0'

mhorlacher avatar Aug 16 '20 11:08 mhorlacher

@gene1wood Solved. Assumed products.some_list[0] queries a collectable, which is not the case.

mhorlacher avatar Aug 20 '20 07:08 mhorlacher