It is possible like that, yes.
https://www.ibm.com/docs/en/api-connect/10.0.5.x_lts?topic=definitions-variable-references-in-api-connect
Original Message:
Sent: Wed October 18, 2023 03:19 PM
From: Srini Acharya
Subject: Jenkins Automation issues
You just opened up a whole new world for me. Yes, the differentiator can be made available via client application on the request header. So, is there a way to dynamically construct target url based on it ? for example, in my api.yaml:
Can I hardcode parts of URL here and append the differentiator ? how does that work ?
------------------------------
Srini Acharya
Original Message:
Sent: Wed October 18, 2023 02:49 PM
From: Szymon Stupkiewicz
Subject: Jenkins Automation issues
There's no single way of achieving this. It all depends on specific requirements and what is the differentiator of the requests. Simplest way would be to leverage switch policy, provided that differentiator of the back-end is already available in the message (i.e. in a header).
You can read more about assembly policies in general here:
https://www.ibm.com/docs/en/api-connect/10.0.5.x_lts?topic=definitions-api-policies-logic-constructs
Switch policy:
https://www.ibm.com/docs/en/api-connect/10.0.5.x_lts?topic=constructs-switch
Basics of using context variables:
https://www.ibm.com/docs/en/api-connect/10.0.5.x_lts?topic=aplc-using-context-variables-in-gatewayscript-xslt-policies-datapower-api-gateway
List of available context variables (for selecting routing differentiator):
https://www.ibm.com/docs/en/api-connect/10.0.5.x_lts?topic=reference-api-connect-context-variables
------------------------------
Szymon Stupkiewicz
Original Message:
Sent: Wed October 18, 2023 02:15 PM
From: Srini Acharya
Subject: Jenkins Automation issues
Hi Thanks again for the quick reply. Do you have any documentation pointing to the API assembly routing ? I am still very new to APIC and didn't realize it had something like this. Thanks !
------------------------------
Srini Acharya
Original Message:
Sent: Wed October 18, 2023 02:09 PM
From: Szymon Stupkiewicz
Subject: Jenkins Automation issues
Correct, for your use case the "Online" toggle is irrelevant.
What I would do to troubleshoot your "Backside URL Invalid" error is either check DataPower logs or make use of Tracing feature in Test tab as I mentioned earlier.
As for your use case, I would explore alternatives to creating multiple catalogs for this pattern, as they are going to be nightmare to manage in the future. For differences between back-end applications I would leverage API assembly to know which back-end to route the request to. For different front-side applications - APIC Applications and Subscriptions to relevant products. That being said, I don't know all your requirements, so it's up to you to decide how to better address them.
------------------------------
Szymon Stupkiewicz
Original Message:
Sent: Wed October 18, 2023 01:18 PM
From: Srini Acharya
Subject: Jenkins Automation issues
Thank you very much for the response ! I have checked the target url and it is valid. So, it looks like what you are saying is the "online" toggle switch is irrelevant for my use case since I am using my own catalog of my choosing correct ?
Also, we have somewhat of an atypical use case where where there are some environments on demand that gets spun up via Jenkins env up. So, each of those instances need to communicate with separate instances of another application via APIC. Therefore, the need to create catalogs "on demand" and publish api (with different target urls) and products to each of them. The catalogs are just a way to namespace this mapping between the 2 instances.
What you are saying makes sense though because when I go into the catalog and browse my product and APIs they all say "active". Not sure why I am getting "Backside URL Invalid" error when invoking via postman.. I will look into debugging this. Thanks !
------------------------------
Srini Acharya
Original Message:
Sent: Wed October 18, 2023 01:14 AM
From: Szymon Stupkiewicz
Subject: Jenkins Automation issues
Hi Srini,
When you are creating a draft api and draft product, they are always created as offline and when you activate them, they will by default always be published to Sandbox catalog. If your goal is to just publish the API in the catalog of your choosing, then your product should already be active in that catalog, therefore step 5 is not needed.
That being said - when you develop your APIs/Products, "Develop APIs and Products" is the perfect place for troubleshooting. By default it uses auto products and Sandbox catalog with default consumer org and automatic subscription. When you use Test tab, it gives you the ability to see the trace of your API call execution, which is helpful in troubleshooting.
The error "Backside URL invalid" might be due to invalid URL in invoke policy, so you would want to check that URL in the first place.
If you want to troubleshoot this issue further in the target catalog, you would either need to go through DataPower logs, or set up an API probe to get the same level of information as in "Test" tab in "Develop APIs and Products".
I'm also curious about your scenario for steps 2,3 and 4. Usually you would want to have a single catalog that is exposing your APIs to Consumers in a single Developer Portal.
------------------------------
Szymon Stupkiewicz
Original Message:
Sent: Mon October 16, 2023 02:21 PM
From: Srini Acharya
Subject: Jenkins Automation issues
Hi all,
I am experiencing issues with automation scripts especially in a scenario with multiple catalogs. I am running the apic commands via Jenkins job. Here is the workflow:
- apic login
- create catalog
- add a user to the catalog
- create consumer org and application
- create a draft api and draft product using existing api and product yaml files
- validate the apis and products and finally publish the product
When I log in to the API manager Web GUI, I can see my catalogs, products and apis under the catalog and they all seem to be created fine.
The main Issue:
When I try to access the endpoint using postman, I get a server 500 error with detail that says "Backside URL invalid". Although, the APIs got created, when I go in to manage it via "Develop APIs and Products" link on the API manager home page, I see that my APIs are not active (it is offline). Then, when I click on settings icon next to the online/offline toggle switch I realize that my target catalog is set to the wrong catalog (even though, I specified the correct catalog during product creation via command line in Jenkins). I also realized that when I set the switch to online, it creates a "auto product" rather than use my version of the product. When I go back to settings and attempt to correct this, It just takes me to a generic "Something went wrong" Error page.
Sorry this was long winded. This issue has really frustrated me for a while now. Just wanted to see if anybody else was experiencing similar issues or if you know the resolution. Please help !!!!
------------------------------
Srini Acharya
------------------------------