Forum Discussion

michaelrowe01's avatar
michaelrowe01
New Contributor
3 years ago

building test steps based on service discovery

This may be a very basic request, but I am trying to review ReadyAPI to see if I can use it to discover API Services, and then call those Services as part of my tests. Are there any examples of how to identify a URL from one API and use it as the API end point of the next step?  My first API provides a catalog of the services available on the server in XML format.

  • Hey michaelrowe01,

    There is a REST Discovery or API Discovery function in ReadyAPI, but ive never used it so probably im not best placed to answer this, but no one else has yet, so i'll try and help out.

    I had a quick look to remind myself and theres a browser component where it records your submissions to a website and theres a non browser version where you use ReadyAPI as a proxy and capture the traffic that way (kinda like using fiddler).

    However, im unsure if those will help you out, considering your second post appears to indicate youre using Postman to poke an endpoint, which returns a response containing a list of endpoints in an xml payload...is that right?

    You mention that you then populate Postman variables using the content of the previous response to build further requests. At this point im a bit confused. The content of the response....does this give you lots of different endpoints or does this give you a list of the same endpoints with different parameter values? (Im assuming REST here, unless you say different?)

    What i mean is, are you getting something like:

    <List>
    <endpoint1>http://whatevs1.com/${parm1}/${parm2}/folder</endpoint1>
    <endpoint2>http://never.co.uk/value/${parm3}/folder1?qparm1=value&qparm2=value</endpoint2>
    <endpoint3>http://catchall.com/folder/${parm4}/folder3</endpoint3>
    </List>

    So.....the list of endpoints in your response...are they completely different hostnames, folder structures and parameters (both URI and query parms) like my above example

    OR

    Are they a list of the same endpoints (same hostnames, same full URI, but the parm (both URI and Query Parms) values differ, but all else is the same?

    Reason im a bit confused is what variables are you taking to build endpoints in Postman?

    Postman has fixed parms just like ReadyAPI....the parm names arent dynamic....only the values are....hence my confusion!

    If youre asking is there a way to build request endpoints to poke dynamically in ReadyAPI where the URI and Query Parm NAMES (not just the values!) are dynamic, this is possible but not with the embedded functionality....you need to do it with groovy.

    I might have completely misunderstood your post however, so if you could respond with more details and especially examples of the API full URLs you get in your response) that can only help our understanding (which will help people answer your questions).

    Cheers,

    Rich

3 Replies

  • richie's avatar
    richie
    Community Hero
    Hey michaelrowe01,

    There is a REST Discovery or API Discovery function in ReadyAPI, but ive never used it so probably im not best placed to answer this, but no one else has yet, so i'll try and help out.

    I had a quick look to remind myself and theres a browser component where it records your submissions to a website and theres a non browser version where you use ReadyAPI as a proxy and capture the traffic that way (kinda like using fiddler).

    However, im unsure if those will help you out, considering your second post appears to indicate youre using Postman to poke an endpoint, which returns a response containing a list of endpoints in an xml payload...is that right?

    You mention that you then populate Postman variables using the content of the previous response to build further requests. At this point im a bit confused. The content of the response....does this give you lots of different endpoints or does this give you a list of the same endpoints with different parameter values? (Im assuming REST here, unless you say different?)

    What i mean is, are you getting something like:

    <List>
    <endpoint1>http://whatevs1.com/${parm1}/${parm2}/folder</endpoint1>
    <endpoint2>http://never.co.uk/value/${parm3}/folder1?qparm1=value&qparm2=value</endpoint2>
    <endpoint3>http://catchall.com/folder/${parm4}/folder3</endpoint3>
    </List>

    So.....the list of endpoints in your response...are they completely different hostnames, folder structures and parameters (both URI and query parms) like my above example

    OR

    Are they a list of the same endpoints (same hostnames, same full URI, but the parm (both URI and Query Parms) values differ, but all else is the same?

    Reason im a bit confused is what variables are you taking to build endpoints in Postman?

    Postman has fixed parms just like ReadyAPI....the parm names arent dynamic....only the values are....hence my confusion!

    If youre asking is there a way to build request endpoints to poke dynamically in ReadyAPI where the URI and Query Parm NAMES (not just the values!) are dynamic, this is possible but not with the embedded functionality....you need to do it with groovy.

    I might have completely misunderstood your post however, so if you could respond with more details and especially examples of the API full URLs you get in your response) that can only help our understanding (which will help people answer your questions).

    Cheers,

    Rich
  • btw, In postman, I would parse the returned XML and pull out the additional service endpoints- place them into environment variables.  I would then use those environment variables for the the endpoint in the next test step.

  • Hey Rich, thanks for the quick response.  Yes, they are fully defined endpoints, with potentially different hostnames. Based on your response it looks like I will need to look at Groovy, as I do need both URI and Parms to be dynamic.  Thanks for the quick and detailed response.