API console in wso2 - url

I have below URL -
http://localhost:8280/ukAddress/v1/NR12GG/bluemill
in which my base url is http://localhost:8280/ukAddress/v1 & need to pass /NR12GG/bluemill as parameter from API console so that /NR12GG/bluemill will get added to the actual url defined in config xml.
How can i achieve this from API console.
THanks,
Amith

You can use /{streetAddress1}/{streetAddress2} and, you can provide {uri.var.streetAddress1} and {uri.var.streetAddress2} to target backend URL.
You can refer HTTP Endpoint for more details

Related

CAS Access Token Not Supported in 6.5.2

I am using CAS-Server as my oAuth server and did all the configuration as mentioned in the documentation.
But when I try to hit the postman for generating accessToken I am getting the below exception.
2022-04-28 22:11:58,625 ERROR [org.apereo.cas.support.oauth.web.endpoints.OAuth20AccessTokenEndpointController] -
java.lang.UnsupportedOperationException: Access token request is not supported
at org.apereo.cas.support.oauth.web.endpoints.OAuth20AccessTokenEndpointController.lambda$verifyAccessTokenRequest$2(OAuth20AccessTokenEndpointController.java:187) ~[cas-server-support-oauth-core-api-6.5.3.jar!/:6.5.3]
Please help me to resolve this error.
I got same error when I hit 'POST /oidc/accessToken' without passing correct parameters. It works after I pass correct parameters. Try this:
Parameters for /oidc/accessToken

Quarkus Manually Set Open API Url

So I know I can change the open api path with quarkus.smallrye-openapi.path=/openapi
However I am using an api gateway and at the beginning of my services I identify them with something like https://gateurl/notification/swagger-ui/
How do I change the url for open api so I don't have to manually put /notification/openapi in swagger each time I open the url
You can use quarkus.swagger-ui.urls to set one or more urls. See https://quarkus.io/guides/openapi-swaggerui#quarkus-swaggerui_quarkus.swagger-ui.urls-urls
Example:
quarkus.swagger-ui.urls.default=https://gateurl/notification/swagger-ui/
This will change the url as you want it.
You can also add both (one that goes through the gateway and one direct for example):
quarkus.swagger-ui.urls.default=https://gateurl/notification/swagger-ui/
quarkus.swagger-ui.urls.direct=/q/openapi
quarkus.swagger-ui.urls-primary-name=default
This will give you a dropdown with the gateway one selected by default.
See https://github.com/phillip-kruger/openapi-example for a example.

AWS API Gateway {"error": "missing authentication token"}

I've been constantly getting the "missing authentication token" error when I click the AWS API gateway POST method url through the browser. I set "AUTH" as none and it's working totally fine through Postman but not with the browser. The problem is that I'm using swift to trigger the method and it doesn't seem to be reaching the gateway at all (no log on CloudWatch) and I don't think my code is wrong (or maybe it is). If someone could point out what my mistake is or a solution to this problem I'd appreciate it so much.
P.S. My lambda function is working totally fine and I typed in the right URL (one in the code is just for example)
Here's my code:
func postNonceToServer(paymentMethodNonce: String) {
let paymentURL = URL(string: "https://example-url.us-east-1.amazonaws.com/prod/create-transaction")!
var request = URLRequest(url: paymentURL)
request.httpBody = "\(paymentMethodNonce)".data(using: String.Encoding.utf8)
request.httpMethod = "POST"
}
In my opinion, this should be a problem in the URL itself. I can think of:
1- Please make sure that the URL is parsed correctly by printing it to the console and pasting it into the browser URL bar. (I have no idea about swift)
2- Make sure that "execute-api" is included in your "example-url", i.e., before the region.
3- Make sure that OPTIONS method has AUTH as none.
Good luck!
After enabling CORS on my endpoints I was receiving the same error message:
{"message":"Missing Authentication Token"}
Everything checked out, but I consistently received that error. To fix my issue I had to deploy the API. To do that, do the following:
Go to "Amazon API Gateway" console
Click on the API Gateway in question
Click "Resources" and select the root resource, e.g., "/"
Click "Actions" and then "Deploy API"
Select the stage you want to deploy to
Click "Deploy"
Long story short, redeploy the API after you've enabled CORS.
This mostly would be because of CORS issue.
Please enable CORS in you API gateway like below. After enabling CORS please redeploy the API
If you don't have OPTIONS added, please follow below steps (If OPTIONS already there just add CORS),
Create a new OPTIONS method under the /services resource
Create and populate the Access-Control-Allow-Origin/Method/Headers in the OPTIONS method.
Enable CORS like below after creating OPTIONS

Swagger UI - "Try it Out!" button call failing

I have installed Swagger UI on my local machine. When I am pulling up some Swagger definitions, the definitions are working fine, however, when I click on the "Try it out!" button, the call fails stating "No response from server".
However, when I take the Request URL from Swagger UI and run it directly in the browser, the server responds (BAU).
Am I missing something? Do I need to setup/configure Swagger UI to make this call happen?
Note: I have just downloaded the latest version of Swagger and running it locally on Windows desktop with Tomcat server.
Please help.
The specs for Swagger-ui is usually in JSON format which contains host(including port), basePath, paths (path array of each API service). Swagger-client will construct the request URL from all these properties and send the request to the URL with an "Accept" header. Now you can not get response from service you need to check whether the backend services are running. You can open browser development tools to capture the HTTP request and see if it is correct.
You can go to http://petstore.swagger.io/ to see how it works.

Impossible to cross site ajax api calls in a chrome extension?

I am trying to create a chrome extension that calls my rails app's api. currently the api returns json and it works fine, however when I try to build it into a chrome extension, it says :
Refused to load script from 'http://mysite.com/demo?q=hello?callback=jQuery16409466155741829425_1342489669670&_=1342489677171' because of Content-Security-Policy.
I looked up the document http://code.google.com/chrome/extensions/contentSecurityPolicy.html and it sounds like I can't do this unless I implement my site into a https version. (under "Relaxing the default policy" section) I am not sure if I understood correctly and it feels ridiculous to make such a big change just because of this. Am I misunderstood? Or is there a workaround to this? Thank you.
In a Chrome extension, cross-site XMLHttpRequests are allowed, provided that you define the source in the manifest file - see http://code.google.com/chrome/extensions/xhr.html.
A JSONP implementation loads an external script using the <script> tag, and inserts it in the document. Unless the source is whitelisted through the "content_security_policy" entry, JSONP cannot be used when manifest version 2 is active (do not use manifest v1 to overcome this, because it's deprecated, and a suitable alternative already exist).
When you're unable to receive a JSON response instead of JSONP, use an ordinary request to fetch the data, cut off the callback, then parse it. Eg:
// response is the response from the server
// Received through `XMLHttpRequest`, jQuery.ajax, or whatever you used
// cuts of jQuery....( and the trailing )
response = response.replace(/^[^(]*\(/, '').replace(/\);?$/, '');
By default browsers do not allow this because of the same origin policy.
However you can get around this by making a jsonp request.
As you using jquery this super easy with getJSON method

Resources