I have created a REST API on Enterprise Integrator and I need to put it on API Manager to consume it from my c# application. Or even from Integration studio to API Manager.
My API is a redirect API that redirects after using a dblookup mediator to search a microsoft sql db to check if the data exists and it then redirects based on that. This is my REST API:
<api xmlns="http://ws.apache.org/ns/synapse" name="DBLookupAPI" context="/dblookup">
<resource methods="GET" uri-template="/{UserCode}">
<inSequence>
<log level="custom">
<property name="Value" expression="get-property('uri.var.UserCode')"/>
</log>
<dblookup>
<connection>
<pool>
<driver>com.microsoft.sqlserver.jdbc.SQLServerDriver</driver>
<url>jdbc:sqlserver://10.1.1.111\test;databaseName=UserDB</url>
<user>admin</user>
<password>admin</password>
</pool>
</connection>
<statement>
<sql>select UserCode from UserDB.dbo.Users where UserCode =?;</sql>
<parameter expression="get-property('uri.var.UserCode ')" type="CHAR"/>
<result name="foundnr" column="UserCode "/>
</statement>
</dblookup>
<log level="custom">
<property name="Value" expression="get-property('foundnr')"/>
</log>
<filter source="boolean(get-property('foundnr'))" regex="true">
<then>
<log>
<property name="Message" value="Name Exists Lets redirect"/>
</log>
<property name="HTTP_SC" value="302"/>
<property name="Location" expression="get-property('env', 'Redirect')" scope="transport"/>
</then>
<else>
<log>
<property name="Message" value="Name Does Not Exist Lets redirect"/>
</log>
<property name="HTTP_SC" value="302"/>
<property name="Location" expression="get-property('env', 'Redirect2')" scope="transport"/>
</else>
</filter>
<respond/>
</inSequence>
<outSequence/>
<faultSequence/>
</resource>
</api>
There is no direct integration with EI and APIM. But you can manually create an API in API Manager using the OpenAPI definitions and other data.
When it comes APIM v4.x and MI 4.x, there is a feature called service catalog. With this service catalog features, you can integrate both these products. When you create and deploy an API in MI, it automatically gets registered with the APIM. From there you can proceed with managing the API at the API Manager.
You can read more about the feature here - https://apim.docs.wso2.com/en/latest/integrate/develop/working-with-service-catalog/