Forum Discussion

bedwar12's avatar
bedwar12
New Contributor
3 years ago

Adding a number to resource path

Hey everyone,

 

Sorry if this is a silly question, I'm new to the platform. But I have a few endpoints here that are gonna be used for load testing, and need to be able to handle order numbers in the resource path. For example, 

 

One endpoint is "/v1/status/online" which I have setup fine. But I'd like it to be able to return its normal 200 response when someone hits the endpoint like "v1/status/online/23243223" (some random order number, different every time). What would be the best way to go about this? Another example is I have an endpoint that is "v1/order/status" that needs to be able to return a response to "v1/order/234234(again, random number)/status." Thanks for any help/insights. 

  • nmrao's avatar
    nmrao
    Champion Level 3
    If I understand right, it must be a template parameter. Isn't it?
    • richie's avatar
      richie
      Community Hero
      Hey bedwar12,

      Whats the field length of the random number?
      Whats the method for the request? Im guessing probably a POST to create a resource as you wouldnt be GETting with a random number?
      Are there any other parameters (values that change) in the full URL of your request? I.e. (im thinking Query parameters) so will the full URL look something like:

      http://whatever.com/v1/status/online/${randomNumber} ???

      If you describe all the different API calls' URI's, the methods, the length of the random number, i'll create a basic project for you with those REST calls setup for you.

      One thing. Do you mean genuinely "random" or would say a 6 digit or 13 digit number incremented by plus 1 at a time suffice?

      If "random" is absolutely essential rather than just "unique", do you want it to be just numeric or does it need to include alpha chars too?

      The more info you give us the easier it will be for forum members to help you out!

      Cheers,

      Rich

    • bedwar12's avatar
      bedwar12
      New Contributor

      I believe that sounds right, where can I add one of these?

    • bedwar12's avatar
      bedwar12
      New Contributor

      I should specify, this is for virtual APIs, if that makes any difference