Directly as data connection no.
Dynamic Query supports a user-defined table-function concept which would require you to implement it in Java. See Cognos SDK docs/call support for more details.
Indirectly you could consider in-database "external" table-functions which can invoke external routines
If your API is really more like a "data source", then consider solutions such as Presto, PostgreSQL etc re foreign data wrappers.
https://prestosql.io/docs/current/connector.html
https://prestosql.io/docs/current/develop.html
------------------------------
NIGEL CAMPBELL
------------------------------