API Connect

 View Only
  • 1.  Test APIs - HTTP Client - How to pass path variable?

    Posted Thu October 05, 2023 08:06 PM

    Hello,

    I tried to pass a path variable with the HTTP Client on "Test APIs". It seems that the client only support parameter (key=value in URL) or header, but does not support path variable?

    For example, in postman, I can use the following URL with path variable "id" and pass the path variable value with path variable definition. 

    https://hapi.fhir.org/baseDstu3/Patient/:id

    Does the HTTP Client support path variable?

    Thanks and regards

    Frank



    ------------------------------
    Frank Ning
    Technical consultant - solution architect
    Toronto ON
    ------------------------------


  • 2.  RE: Test APIs - HTTP Client - How to pass path variable?

    Posted Fri October 06, 2023 07:26 AM
    Edited by Ivy Ho Fri October 06, 2023 07:42 AM

    Are you using the Test and Monitor  (ATM) feature?  or you are using the Test tab when you edit the API?

    Which version(s) of OAI will you be exploring? or just 3.0.2 OAI3? 



    ------------------------------
    Ivy Ho
    ------------------------------



  • 3.  RE: Test APIs - HTTP Client - How to pass path variable?

    Posted Fri October 06, 2023 07:57 AM

    Hiya Frank

    I tried this myself and had the same issue as you. For what its worth I could get it working for OAI2 APIs but not OAI3. I have raised a bug on our UI team to investigate it further. A new revamped test tool is coming later this year, but the existing one should be fixable for this too.



    ------------------------------
    Chris Dudley
    ------------------------------



  • 4.  RE: Test APIs - HTTP Client - How to pass path variable?

    Posted Fri October 06, 2023 08:16 AM

    Thanks for your response, Chris and Ivy.

    I have no issue with path parameter in API's test tab as shown below

    However, in the "Test APIs" interface, no option to specify to use path parameter. The "Parameter" part is really for query parameter. I am not able to use it to pass path parameter.

    Thanks and regards

    Frank



    ------------------------------
    Frank Ning
    Technical consultant - solution architect
    Toronto ON
    ------------------------------



  • 5.  RE: Test APIs - HTTP Client - How to pass path variable?

    Posted Sat October 07, 2023 07:13 AM

    Hi Frank, The ATM team will respond soon.  By the way, there is also the explorer-try it where you can also do API Testing. It is pretty neat and easy to use as well.  The reason why there are different tooling around, they serve different purpose. The edit API->Test and Debug(Test tools) is focus on tracing and debugging with the Gateway probe.  As  Chris mentioned, we are working on a new Test Tool to better user experience - especially with support of OAI3.



    ------------------------------
    Ivy Ho
    ------------------------------



  • 6.  RE: Test APIs - HTTP Client - How to pass path variable?
    Best Answer

    Posted Sat October 07, 2023 06:13 PM

    Hi Frank, 

    In the Test APIs interface you can specify Path variables in the URL using a syntax like ${variableName} - see for example:

    These can then be populated from the Global Variables or from an Input Set - see the panel on the left "Data Sets"

    Thanks


    Ricky



    ------------------------------
    Ricky Moorhouse
    IBM API Connect Cloud Architect
    ------------------------------