GithubHelp home page GithubHelp logo

BasePath json element not available in API Manager 7.7 when API is created using swagger promote scripts 1.5.2-1 about apimanager-swagger-promote HOT 17 CLOSED

axway-api-management-plus avatar axway-api-management-plus commented on June 29, 2024
BasePath json element not available in API Manager 7.7 when API is created using swagger promote scripts 1.5.2-1

from apimanager-swagger-promote.

Comments (17)

hakila avatar hakila commented on June 29, 2024 1

When create API through UI manually and publish it, i got export file as cat 6 ui apmgr77.dat.txt (See attached particularly for backend blob element)
When same API created using apimanager-swagger-promote-1.5.2-1/scripts/run-swagger-import.sh by using TESTSWGIMPSCRPT1521MinimumStayCategory06Rules_transformed-config.json.txt and TESTSWGIMPSCRPT1521MinimumStayCategory06Rules_transformed.json.txt as input config and json file, backend blob is different, I dont see basePath here whereas above i see that.
Same is noticed with apimanager-swagger-promote-1.5.3/scripts/run-swagger-import.sh by using TESTSWGIMPSCRPT153MinimumStayCategory06Rules_transformed-config.json.txt and TESTSWGIMPSCRPT153MinimumStayCategory06Rules_transformed.json.txt as config and json input files.
What chnages I have to make, to get same export file from both manually created API and swaggerpromote script created API.

from apimanager-swagger-promote.

hakila avatar hakila commented on June 29, 2024

Also attaching input config file and json file to scripts
TESTSWGIMPSCRPT153MinimumStayCategory06Rules_transformed.json.txt
TESTSWGIMPSCRPT153MinimumStayCategory06Rules_transformed-config.json.txt
TESTSWGIMPSCRPT1521MinimumStayCategory06Rules_transformed.json.txt
TESTSWGIMPSCRPT1521MinimumStayCategory06Rules_transformed-config.json.txt

from apimanager-swagger-promote.

cwiechmann avatar cwiechmann commented on June 29, 2024

@hakila, unfortunately I don't get your point. Can you perhaps re-phrase your question?

What do you mean with, that Swagger-Promote is creating different JSON-Formats? I mean it is meant to consume a JSON API-Config-File, but not producing it.

from apimanager-swagger-promote.

cwiechmann avatar cwiechmann commented on June 29, 2024

The blob you are referring to, is the presentation of the Swagger-File that has been imported into the API-Manager (section Backend-API). We call it the original Swagger-File, which you get when using the option: "Download original API Definition".

Swagger-Promote is doing nothing special at this point, that's I'm wondering why there is a difference. It takes the Swagger-Definition it gets and calls the REST-API: /api/portal/v1.3/apirepo/import/ to import the Backend-API. That's all. No special handling. Nothing.

The difference, which might not so obvious, is that Swagger-Promote is always using the option: "Import from file", even if you are telling Swagger-Promote a URL. It downloads the file locally and is using it from there.

When you are using the UI, are you using import from URL option? If yes, please try to import it from file as Swagger-Promote is doing it. And then check, if you encounter the same missing basepath.

from apimanager-swagger-promote.

hakila avatar hakila commented on June 29, 2024

I just did swagger import file option through ui, i got same ouput as url. I did see basePath.
Swaggerimport scripts is doing something different,
I see this
\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t many of these are there in the exported file that was created using scripts but not seeing those when created manually either through swagger url or import file. Are you using any encryption? Backend blob is completely different. Also attaching the output that was created manually through import swagger file option.
cat 6 uiswgrfile apmgr77.dat.txt

from apimanager-swagger-promote.

cwiechmann avatar cwiechmann commented on June 29, 2024

To summarize, this is how it looks like when using the UI:

  "backend": {
    "apiBlobs": [
      {
        "id": "40679807-25ae-4ad8-856d-22f19e028ba6",
        "type": "swagger11ex",
        "blob": "{\"id\":\"40679807-25ae-4ad8-856d-22f19e02

And that way, when Swagger-Promote has imported the API:

  "backend": {
    "apiBlobs": [
      {
        "id": "65f4037e-e2e0-41a2-830b-36ce5e66b4b8",
        "type": "swagger20",
        "blob": "<!-- \n    ResourceRepository export from com.vordel.rr.es.ESResourceDAO on 9 Jul 20

That looks totally different, as it seems, that the Swagger-File is encapsulated in that structure. Let me investigate the root cause for that.

from apimanager-swagger-promote.

hakila avatar hakila commented on June 29, 2024

Thank you so much for the response. We do some changes in json elements like basepath after the invocation import rest call in higher environments. If we cannot retain the same json structure with swagger promote create, ui manual create it will be big show stopper for us.

from apimanager-swagger-promote.

cwiechmann avatar cwiechmann commented on June 29, 2024

I identified a potential cause and fixed it. Will be part of the next release.

from apimanager-swagger-promote.

hakila avatar hakila commented on June 29, 2024

Thank you for addressing this quickly. In API Manager 7.5.3, I see baspath and host but basepath value is different from manual UI API creation.
This is how I created in UI both 7.7 and 7.5.3
Create Backend using swagger url or file. BackEnd API comes as Read only. Clone the backend API and make necessary changes i.e we change resourcePath at api level and path value at method level. Save and then create the front end from this. Delete the backend api that got created using swagger url/file.
Hope with your fix , this scenario is tested i.e generate same json through script and the above process i mentioned for both API manager 7.5.3 and 7.7.
If possible, can you provide snapshot version, so that I can test?

from apimanager-swagger-promote.

cwiechmann avatar cwiechmann commented on June 29, 2024

Hi @hakila, this is the most recent version. Thanks for your feedback.

apimanager-swagger-promote-1.6-SNAPSHOT.tar.gz

from apimanager-swagger-promote.

hakila avatar hakila commented on June 29, 2024

I just tested snapshot script with api manager 7.7 but it is still not working. Attaching the exported json after creating API. Attached input files(config file and json file) and cat.6.swgimp16ss.apmgr77.dat.txt is the exported json. I am still seeing same issue as before. Please investigate.
Running API-Manager Promote version 1.6-SNAPSHOT ...
0 INFO App| ------------------------------------------------------------------------
0 INFO App| API-Manager Promote Version: 1.6-SNAPSHOT
0 INFO App|
0 INFO App| To report issues or get help, please visit:
0 INFO App| https://github.com/Axway-API-Management-Plus/apimanager-swagger-promote
0 INFO App| ------------------------------------------------------------------------
10 INFO nvironmentProperties| Loaded environment properties from file: env.properties.
843 INFO APIManagerAdapter| API-Manager version is: 7.7.0
971 INFO IImportConfigAdapter| Reading API-Definition (Swagger/WSDL) from file: '/opt/axway/pythonscripts/conf/apicreatejson/TESTSWGIMPSCRPT16SSMinimumStayCategory06Rules_transformed.json' (relative path)
972 INFO IImportConfigAdapter| Handling configured client-applications.
1050 INFO IImportConfigAdapter| Found existing application: 'ATP_ATP_Apps' based on given name 'ATP_ATP_Apps'
1145 INFO APIManagerAdapter| No existing API found exposed on: '/services/testswgimpscrpt16ss/v1/rules/record3/cat6'
1146 INFO APIManagerAdapter| Strategy: No existing API found, creating new!
1148 INFO APIManagerAdapter| Importing backend API (Swagger/WSDL Import)
1282 INFO APIManagerAdapter| Create API-Proxy (Front-End API)
2487 INFO APIManagerAdapter| Updating proxy for the following properties: descriptionType descriptionMarkdown securityProfiles tags outboundProfiles corsProfiles path name
2510 INFO APIManagerAdapter| Updating API-Image from: /opt/axway/apiimages/Ticket.png
2570 INFO APIManagerAdapter| Updating Application-Default-Quota for API: TEST SWGIMPSCRPT16SS Minimum Stay (Category 06) Rules
2702 INFO APIManagerAdapter| Application-Default quota successfully updated: TEST SWGIMPSCRPT16SS Minimum Stay (Category 06) Rules
2727 INFO APIManagerAdapter| Granted permission to organization: '[ATP_ATP_Org]'
2727 INFO APIManagerAdapter| Creating API-Access for the following apps: '[[ATP_ATP_Apps]]'
2753 INFO App| Created API-Properties file: '/opt/axway/pythonscripts/conf/apiconfigjson/TESTSWGIMPSCRPT16SSMinimumStayCategory06RulesDetails.prop'
2753 INFO App| Successfully replicated API-State into API-Manager
retCode from swagger script: 0

TESTSWGIMPSCRPT16SSMinimumStayCategory06Rules_transformed-config.json.txt
TESTSWGIMPSCRPT16SSMinimumStayCategory06Rules_transformed.json.txt
cat 6 swgimp16ss apmgr77.dat.txt

from apimanager-swagger-promote.

cwiechmann avatar cwiechmann commented on June 29, 2024

I did some research on the root cause and found the reason for the different behavior. When importing an API using Swagger-Import (no matter if using the UI or Swagger-Promote) it always goes into that blob using that magic format:
<!-- \n ResourceRepository export from

The difference is the additional step you do, by Cloning the Backend-API, which flips the previously imported API internally into another mode (indicating the API has been manually created) and from that point on, you get the other API-Export Format.

Unfortunately there is nothing Swagger-Promote can do here, as this is API-Manager internal. You can easily validate yourself by:

  • Importing an API using Swagger-Promote
  • Delete the created FE-API
  • Clone the previously imported BE-API
  • Create a new FE-API on top of the clone
  • Export the API-Collection --> That version contains the format you expect.

from apimanager-swagger-promote.

hakila avatar hakila commented on June 29, 2024

So, there is no way I can change basePath in backend blob as it is different in different environment using my export import scripts? Please suggest alternative . I understand that API has to be deployed through CI/CD but until we are comfortable we want to use it only in dev env and rest of the environments we use export/import customization script.

from apimanager-swagger-promote.

hakila avatar hakila commented on June 29, 2024

Also, in the attached exported json files for the APIs created through UI, I dont see basePath value. How it will resolve to backend value? For example for the attached apis, backend path is http://minstay6-cmrules-dev.npapps.ose.atpco.org but I don't see that value. How API know to resolve?

from apimanager-swagger-promote.

cwiechmann avatar cwiechmann commented on June 29, 2024

The actual backend host is stored inside the blob element and Base64 encoded, that's why you don't see the actual value. Anyway, I wouldn't manage it that way, as the blob is meant to be parsed internally and should just hold a representation of the originally imported Swagger-File. Even if it is obviously used for backend-routing, that's not the place to change it.

Instead create a new Service-Profile. It must look like this:

  "serviceProfiles": {
    "_default": {
      "apiId": "b8fba94e-671c-46c5-9e63-f572a660ad44",
      "basePath": "http://somewhere.else.com"
    }
  },

I think you can even omit the apiId, but I'm not sure and you have to test it.

from apimanager-swagger-promote.

hakila avatar hakila commented on June 29, 2024

So you reverted the fix that you mentined above? Or is that still a bug
On API-BE-Import changed content-type from application/octet-stream to application/json?

from apimanager-swagger-promote.

cwiechmann avatar cwiechmann commented on June 29, 2024

No, the change is part of 1.6.0

from apimanager-swagger-promote.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.