Hi all
I am new to APIs and am working on create an API that can extensible and flexible . . How would I abstract that information. Any suggestion or guidance ,would greatly be appreciate . I have been reading a few books and am confused
The use case is an object can have state specific attributes and state specific values .
I will use Tesla in this hypothetical example
It can create {model3, p85,p100,plad,plad+}models , in the state of AZ , they only build available is "plad" model . In the NY they only build is "plad+" model. But in the state of NY they also add an hitch option
I have provide 3 options below . Please let me know which one do you prefer or is there another option ?
For example if I make an API call
[option1]
www.yyy.com\cars\tesla
But the above does not seem right to me
[option 2]
should I do it like this
www.yyy.com\cars\tesla\AZ
and
www.yyy.com\cars\tesla\NY
or
[option 3]
www.yyy.com\cars\tesla
like the solution for the last option above ,To deign based on the above solution
Not sure on the c#/java code on how to construct . If they had another state specific behavior similar to build
Would the approach of a class interface with 50 sub states work to have state specific attributes ? Does this approach cause issues , or is this a good way to go.
Finally , but am not sure how do I create dynamic information for swagger or how do I create dynamic documentation for client to consume that they will know the dynamic values
I was looking to create documentation on my API , and thought of using swagger . But swagger does not enable dynamic represent ion . How do I communicate this on my API any other suggestions on documentation .
[option 1] is easy to document , [option 3] is hard to document
Thanks for taking time to read and appreciate your help
-Ryder