testingibm-mobilefirstpostmanmobilefirst-adapters

How to test MobileFirst Adapter API outside of application


I am going through the tutorials of IBM MobileFirst. I have created an android application in MobileFirst and uploaded the Java HelloWorld adapter.

I can successfully trigger the API (such as the greet function) through my android app and I get back the desired result. But I would like to test the API also in the Browser, or through curl or through postman... But whenever I use the Browser or curl or Postman with:

http://localhost:XXXPORTXXX/mfp/api/adapters/SampleAdapter/resource/greet?name=myname

I dont get any string back... the browser stays empty and curl does not write anything...


Solution

  • If you're using MobileFirst v8, the adapter APIs are exposed as a Swagger doc. The swagger doc also gives you the curl command to run. However, this works only on unprotected adapter methods.

    If you wish you use this with protected methods, then you'll need to make use of a confidential client. See https://mobilefirstplatform.ibmcloud.com/tutorials/en/foundation/8.0/authentication-and-security/confidential-clients/

    Swagger documentation for adapter APIs

    enter image description here