I am having to retrieve 50 different json’s from an external API.
I am curious if I can build a model for each json statically or possibly dynamically.
Some of the services (api’s) offer a meta call that allows me to get the structure of the json.
Should this be a component class or extension?
I am playing with it in a controller right now but eventually I need to build something to handle all of the different services.
Any advice would be appreciated.
Thanks!
yiqing95
(Yiqing 95)
2
surely you can extend the CModel class !
if i were you ,i may do this thinking: the api provider like rdbms can be treat as a dbConnection(api url is same to dsn) .
in rest style api : the resource is similar to table .
hope to hear others voices!
Thank you yiqing95!
I agree with your analogy of the api url (db connection) and resource (table)
If you know of any good examples, please let me know.
Thanks!