GithubHelp home page GithubHelp logo

Comments (16)

cwiechmann avatar cwiechmann commented on June 29, 2024

Thanks for feedback. And you are right, the version information is just a Meta-Information, which has no special impact in terms of routing, etc.
If you have Non-Breaking-Changes for an existing API, I recommend to update the existing API-Definition and stick to the exposure path /api/v1/..... (of course, this should be case most of the times)
If you have Breaking-Changes, you must go for a new exposure path /api/v2/... and use the API-Manager Feature: "Grant access to newer API", which will take over applications to your new API.

In both cases, you can update the Version-Meta-Information as you want.

from apimanager-swagger-promote.

cbrowet-axway avatar cbrowet-axway commented on June 29, 2024

Sure, that's a solution, but that's not always what the customer wants ;)

Just to be clear, I'm talking about https://docs.axway.com/bundle/APIManager_762_APIMgmtGuide_allOS_en_HTML5/page/Content/APIManagementGuideTopics/api_mgmt_version_routing.htm
Would be nice to be able to use the full Manager capabilities.

For reference, here is what's currently pops up in the Manager traces when trying to create a new version (with same path, ofc), while a 405 is returned to apimanager-promote.
The "2 runtime(s)" are actually ones created via the webui with different query versions.


INFO 15/May/2019:15:22:35.515 [515e:9b12dc5cdc158db1f3d0c05f] Importing API 'CalculatorRestTEST' from Swagger 2.0 for organizationId ce456118-2f5c-456a-975d-e0b6f6942f4b
--
ERROR 15/May/2019:15:22:36.065 [5196:000000000000000000000000] Path conflict with 2 runtime(s), including VAPI CalculatorREST on host 'null' and path /calculator/rest
ERROR 15/May/2019:15:22:47.815 [50b6:9b12dc5cde15d3accaf4adca] java exception:
java.lang.RuntimeException: Request failed
at com.vordel.common.http.SecureHttpClient.execute(SecureHttpClient.java:173)
at com.vordel.common.http.SecureHttpClient.options(SecureHttpClient.java:114)
at com.vordel.apiportal.common.CertificateReader.getCertsFromUrl(CertificateReader.java:58)
at com.vordel.apiportal.api.portal.controller.PortalController.getCertInfo(PortalController.java:898)
at com.vordel.apiportal.api.portal.controller.ApiProxyController.internalImportCertificates(ApiProxyController.java:763)
at com.vordel.apiportal.api.portal.controller.ApiProxyController.createVirtualizedAPI(ApiProxyController.java:602)
at com.vordel.apiportal.api.portal.v1_2.APIProxyRegistration.virtualizeApi(APIProxyRegistration.java:185)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81)
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:144)
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:161)
at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:160)
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:99)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:389)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:347)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:102)
at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:326)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305)
at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154)
at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:473)
at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:427)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:388)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:341)
at com.vordel.apiportal.api.PortalServletContainer.service(PortalServletContainer.java:64)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:228)
Caused by: java.net.NoRouteToHostException: No route to host (Host unreachable)
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at org.apache.http.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:339)
at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:142)
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:359)
at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:381)
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:237)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:185)
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:111)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
at com.vordel.common.http.SecureHttpClient.execute(SecureHttpClient.java:153)
... 33 more
```

from apimanager-swagger-promote.

cbrowet-axway avatar cbrowet-axway commented on June 29, 2024

apimanager-promote output:

14106  INFO     APIManagerAdapter| Updating proxy for the following properties: descriptionType descriptionManual securityProfiles outboundProfiles serviceProfiles path version name summary
14126  ERROR    APIManagerAdapter| Last request: {"errors":[{"code":500,"message":"Internal server error"}],"descriptionType":"manual","descriptionManual":"This is my __markdown__ based API description.","securityProfiles":[{"name":"_default","isDefault":"true","devices":[{"name":"Invoke Policy","type":"authPolicy","order":"1","properties":{"authenticationPolicy":"<key type='CircuitContainer'><id field='name' value='Argenta2'/><key type='CircuitContainer'><id field='name' value='Inbound Security'/><key type='FilterCircuit'><id field='name' value='Generic Inbound Policy'/></key></key></key>","useClientRegistry":"false","subjectSelector":"authentication.subject.id","descriptionType":"original","descriptionUrl":"","descriptionMarkdown":"","description":""}}]}],"outboundProfiles":{"_default":{"routeType":"policy","requestPolicy":null,"responsePolicy":null,"routePolicy":"<key type='CircuitContainer'><id field='name' value='Argenta2'/><key type='CircuitContainer'><id field='name' value='Routing'/><key type='CircuitContainer'><id field='name' value='Calculator'/><key type='FilterCircuit'><id field='name' value='CalculatorFromRest'/></key></key></key></key>","faultHandlerPolicy":null,"apiMethodId":null,"apiId":null,"authenticationProfile":"_default","parameters":[]}},"serviceProfiles":{"_default":{"apiId":null,"basePath":"https://any.server.com:7676"}},"path":"/calculatorTEST/rest","version":"3.0","name":"CalculatorRestTEST","summary":"My complete API-Summary"}
14126  ERROR    APIManagerAdapter| Unable to parse received response from API-Manager: '<html><body>Method Not Allowed</body></html>'
14126  ERROR          RestAPICall| Response: 'HTTP/1.1 405 Method Not Allowed'
14127  ERROR                  App| Cannot update API-Proxy.
com.axway.apim.lib.AppException: Cannot update API-Proxy.
        at com.axway.apim.actions.tasks.UpdateAPIProxy.execute(UpdateAPIProxy.java:53)
        at com.axway.apim.actions.CreateNewAPI.execute(CreateNewAPI.java:57)
        at com.axway.apim.swagger.APIManagerAdapter.applyChanges(APIManagerAdapter.java:132)
        at com.axway.apim.App.run(App.java:160)
        at com.axway.apim.App.main(App.java:42)
Caused by: com.axway.apim.lib.AppException: Unable to parse HTTP-Response
        at com.axway.apim.actions.rest.RestAPICall.parseResponse(RestAPICall.java:73)
        at com.axway.apim.actions.rest.PUTRequest.execute(PUTRequest.java:28)
        at com.axway.apim.actions.tasks.UpdateAPIProxy.execute(UpdateAPIProxy.java:51)
        ... 4 more
Caused by: com.axway.apim.lib.AppException: Unable to parse response
        at com.axway.apim.actions.tasks.UpdateAPIProxy.parseResponse(UpdateAPIProxy.java:78)
        at com.axway.apim.actions.rest.RestAPICall.parseResponse(RestAPICall.java:65)
        ... 6 more
Caused by: com.axway.apim.lib.AppException: Unable to parse received response from API-Manager
        at com.axway.apim.actions.tasks.UpdateAPIProxy.parseResponse(UpdateAPIProxy.java:76)
        ... 7 more
Caused by: com.axway.apim.lib.AppException: Error updating API-Proxy. [Return-Code: 405, Response: '<html><body>Method Not Allowed</body></html>'
        at com.axway.apim.actions.tasks.UpdateAPIProxy.parseResponse(UpdateAPIProxy.java:65)
        ... 7 more

from apimanager-swagger-promote.

cwiechmann avatar cwiechmann commented on June 29, 2024

Yeah, agree. Should be an relatively easy task to add support Query-Based versioning as well. Will end up in a new config-property: queryVersion=v1 or so.

BTW: The exception is caused by the API-Manager which is trying to download SSL-Certificates from the Backend-System and that fails:
Caused by: java.net.NoRouteToHostException: No route to host (Host unreachable)
This is line that tells me that:
com.vordel.apiportal.common.CertificateReader.getCertsFromUrl(CertificateReader.java:58)

At least my understanding.

from apimanager-swagger-promote.

cbrowet-axway avatar cbrowet-axway commented on June 29, 2024

Ah, you're probably right.
I left "backendBasepath" to a dummy url, as this test is using a routing policy, and the backend is a dummy as a whole in this case.
Just tried putting "http://www.google.com" and same error, which is pretty strange, though.

I'll do more tests...

from apimanager-swagger-promote.

cbrowet-axway avatar cbrowet-axway commented on June 29, 2024

Follow-up:
The ssl error was due to an invalid host in the swagger.

I confirm running the promote with query string enabled generates an invalid API

image

from apimanager-swagger-promote.

cwiechmann avatar cwiechmann commented on June 29, 2024

Yes, that make sense, as the Query-String version routing isn't supported. I'll add this soon to the tool.

from apimanager-swagger-promote.

cbrowet-axway avatar cbrowet-axway commented on June 29, 2024

Thanks :)

from apimanager-swagger-promote.

cwiechmann avatar cwiechmann commented on June 29, 2024

@cbrowet-axway, what do you think should happen, if the API-Manager is configured for the Query-Routing-Option, but the API-Configuration doesn't contain the parameter: apiRoutingKey?

Should the tool block the API-Replication?
Or should it handle some default? (could be loaded from the env.properties file)

from apimanager-swagger-promote.

cbrowet-axway avatar cbrowet-axway commented on June 29, 2024

Good question.
As it is deemed an error on the webui, I guess it should be an error on swagger-promote, too...
An alternative would be to to take MAX+1 by default, but I'm not sure being non-explicit is desirable, really. Nah, can be plain string if not mistaken

from apimanager-swagger-promote.

cwiechmann avatar cwiechmann commented on June 29, 2024

@cbrowet-axway, have it implemented that way now. If the API-Manager configuration conflicts in one or the other way, the API-Replication is stopped.
However, this only works, when having an Admin-Account, as the OrgAdmin can't read the API-Manager configuration. Let's is this is an issue in reality!

I was thinking about that default option as well using an optional parameter in the env.properties which could be set per stage:
defaultApiRoutingKey=v1.2
That would be used, if the API-Manager has the Query-String-Option enabled, but API-Config hasn't declared it. With that, the API-Definition becomes valid. Would that be helpful?

However, this Default-Handling will become eventually part of a future release. Perhaps better to wait for feedback to see what is really needed.

from apimanager-swagger-promote.

cbrowet-axway avatar cbrowet-axway commented on June 29, 2024

I was thinking about that default option as well using an optional parameter in the env.properties which could be set per stage

Not convinced, tbh. If we put queryString on the same level as path-based versioning, it would basically mean having a default path. Furthermore, that'd potentially mean having different "query version" per environment for the same functionality, which would be super confusing...

On the contrary, if we consider the "source" json as a versioned configuration item, the version string definitely should be explicit.

OTOH, having the query string defaulted to the version string if not explicited might be a good compromise.
That would also make the source "cross-compatible" and not depending on whether "query string versioning" is enabled or not.

from apimanager-swagger-promote.

cwiechmann avatar cwiechmann commented on June 29, 2024

Has been released with version 1.5.2.

from apimanager-swagger-promote.

cwiechmann avatar cwiechmann commented on June 29, 2024

@cbrowet-axway, even if version 1.5.2 now supports Query-String routing, I think there is still a logical issue.
Right now, the tool is using only the API-Exposure-Path (e.g. /minimal/api/v1) to identify an existing API in the API-Manager. BUT, when using the Query-String-Routing option, that's not correct anymore as you can have n-APIs with the same exposure path, but different Query-String-Versions configured.

I mean, the lookup must work like this:

  • when Query-String-Option is enabled in API-Manager
  • identify an existing API by using the configured Exposure-Path + Query-String-Version

Would you agree on that?

from apimanager-swagger-promote.

cbrowet-axway avatar cbrowet-axway commented on June 29, 2024

Yep.
I'd consider checking the option in API manager a validation, though.
You might assume that if the "querystring" option is specified in the promote json, then you have to take it into account as the API id...

from apimanager-swagger-promote.

cwiechmann avatar cwiechmann commented on June 29, 2024

Okay. Thanks for confirming and will change it like this!

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.