Ryder Rodriguez

Greenhorn
+ Follow
since May 12, 2021
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Ryder Rodriguez

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



2 years ago
Thanks Rob and Stephan for taking the time to reply. Appreciate your help
2 years ago
Hi I am a noob to the swagger schema world and would appreciate any guidance on how to create the schema

{
state:"AZ"
chocolates:1
}


In the above request the value of chocolates  driven by the state field and the values for each state are bound within a range For example :

If I entered state:UT and chocolates:1 in the request

I need to makes sure the value of chocolates is in between the range  1-10

If I entered  state:UT and  chocolates:12  in the request

I need to throw an error as it does not fall in the range of 1 to 10

If I entered state:NY and chocolates:2 in the request

I need to makes sure the value of chocolates is in between the values of 2-6


what is the best way to create the API ?

http://www.xyx/getChocolates

or

http://www.xyx/getChocolates/AZ
-> with the above do I have to create 50 schemas one for each state
     will this be a nightmare to maintain
     should I  create a table to store this values or will a property file or a constant file  suffice

Thanks for your help in advance



Any help and guidance would be appreciated
-Ryder
2 years ago