AWS API Gateway : route error - api

I created my API in EC2 instance of AWS. when I'm deploying my API in to AWS Api gateway. API Gateway provided me with a link. When I used that same link in postman to access my API, I'm getting the following error, despite providing IAM credentials.
The Error I'm facing is
{
"message": "No method found matching route / for http method GET."
}

I had the same problem and solved it. The problem is in the Invoke URL you're using. To fix this, please correct path: check the Deployment API link + double check what method you want to call.
You may need to add some more path variables after "/". E.g., "test", whatever, so path finishes with method you'd like to invoke.
I created test project for you, please see screenshot with example. So, in order for script to execute math operation, e.g. "add", you add "/math/add", not default invoke URL:
Good luck!

Check the "Auth" section of your method request in the API gateway.
I had the same response until I set Auth to "AWS_IAM"

Related

GetAccessTokenForUserAsync throws an exception

I'm trying to call a Web API from a Web App, passing a token for identifying the user.
I'm following the docs here:
https://learn.microsoft.com/en-us/azure/active-directory/develop/scenario-web-app-call-api-acquire-token?tabs=aspnetcore
However, when I call the GetAccessTokenForUserAsync method, I always get an error AADSTS65001, stating that The user or administrator has not consented to use the application with ID '....' named '...'.
I really don't understand this error. What kind of consent are we looking for here? The application ID mentioned in the error message is the client app, and I double checked that the scopes accessed from the client app in the API are already consented.
What am I missing? I thought it should be quite straightforward - take the token received by the web app, send it to the web API, and let it authenticate it.
Is there any simple way of doing that?
Thanks!
So for future reference, the problem was that the scopes specified in the GetAccessTokenForUserAsync method were not prefixed with the API URL prefix (usually in the form of api://346363-35262ffe-23cwf3-ve523632t), and therefore Azure AD assumed I was trying to access my own app, which did not have such scopes.
After I changed the code to include the prefix in the scope, ie. _tokenAcquisition.GetAccessTokenForUserAsync(new[] { $"api://346363-35262ffe-23cwf3-ve523632t/Employees.Read" }) it worked like a charm.

Amazon Connect API didn't response correctly in Postman

I am trying to test Amazon Connect Rest API in Postman. The API name is GetMetricData. In Postman, I have provided all the required information that is mentioned in the documentation. I have provided the JSON body, URL, and Header, although API is responding 200 OK status but in the response, it is throwing the following errors that you can see in the following screenshots.
I have set AWS signature with proper credentials such as access key and secret key
In the second error it is suggesting me to enable Javascript in the browser which is already enabled in my browser.
Can someone please help me here, I don't know where I am doing wrong. As I am totally new in this field, any help would be appreciated.
Thanks
You are submitting the POST request to the UI distribution endpoint for your Amazon Connect instance, not an API endpoint. You are getting HTML and javascript response body back from the UI distribution because this is meant to be consumed by a browser.
Your API request should be sent to a URL that looks like https://connect.us-west-2.amazonaws.com/metrics/historical/<instanceId>. In this example, my Amazon Connect instance is located in the us-west-2 region so I'm using the connect.us-west-2.amazonaws.com endpoint. You can find all available Amazon Connect API endpoints in the documentation here

Api object in Genexus returns Method Not Allowed

can anyone help me?
It is my first time creating an API Object in Genexus. I've already yaml archive:
I need to test in Postman but I received this error:
If you a re using IIS try this:
How To change the IIS configuration to use PUT and DELETE in API object:
You change the verbs in the IIS configuration, in the "Extensionless-URLHandling-Integrated" you double click, you go to Restrictions / Verbs and you have to add PUT and DELETE (or select ALL verbs)
You have to change it at the Server level (Default Web site)
The problem seems to be that your endpoint doesn't support "post" request. In the image I only see a "get" declaration...so you have to change POST to GET on your Postman.
Thanks for your answers, the API object was defined as GET, that was wrong, so I made it POST and now it is working.

Is it possible to use AWS API without Authentication Token

I try to use AWS lambda. I don't want to use any authentication - it is a simple test function. I receive
{
"message": "Missing Authentication Token"
}
Is it possible to use AWS API without Authentication Token?
Thanks in advance.
Yes, it's possible. You can configure if you want to use Authorization, Request Validator or API key for each resource you created.
Also make sure you invoke the right URL and path of your API, because I had the same issue when I tried to trigger an undeclared path.
Yes, you can create it without Authentication. It means it will default execution role. I have a video blog on the same, which creates and run API without any authentication token. Please see the same below,
https://youtu.be/0HwO14p9cjk
Always remember to deploy API after any change :)

Invoking wso2greg Artifcat Rest API via wso2api manager is not working - any ideas to fix

UPDATED QUESTION to clarify more.
I have two servers : wso2greg containing custom artefacts and wso2am (api manager).
The gouvernance register is intended to be used internally (intranet) and some of it's feature are intended to be exposed externally and acceded via it's rest API.
In order to manage wso2greg API accesss, we used an wso2am (api manager) server, where we did define an API that act as a proxy for the wso2greg API.
In our experiments, we found the strange behaviour described below :
Successfully direct calling wso2greg artefact rest api (the exact url is
https://localhost:9443/resource/1.0.0/artifact/_system/governance/myartifact/art1 and i'm following the documentation of this REST API from here https://docs.wso2.com/display/Governance520/Resources+with+REST+API ) using postman. The API reacts as described in the documentation.
Error 500, reported on wso2greg server, when calling the same REST API, but via API manager (using publisher application).
So as a summary :
Directly calling wso2greg rest API woks fine and a got results back
Adding this working API, in wso2am and than calling it gives always error 500.
As extra information:
Tested with other wso2greg REST API , such as "rating" or "comments" and I was able to call it successfully either directly or throw Api manager.
Tried to get information related to default wso2greg artifacts such as restservice, but i got exactly the same pb when (error 500) interagting with API manager.
Working with the last version of both products : wso2greg version 5.2.0 and wso2am version 1.10.0
Please advice, or clarify how could i debug this internal error in wso2greg.
Regards,
I hope your not using G-Reg + APIM feature installed version. I presume your using separate G-reg 5.2.0 and APIM x.x.x. Since your using the second option you can't use G-Reg REST API with APIM, therefore you have to use APIM REST API instead.
Get an API
Description: Get details of a specific API.
URI: http://localhost:9763/publisher/site/blocks/listing/ajax/item-list.jag
URI Parameters: action=getAPI&name=xxx&version=xxx&provider=xxx
HTTP Methods: POST
Example:
curl -X POST -b cookies http://localhost:9763/publisher/site/blocks/listing/ajax/item-list.jag -d "action=getAPI&name=PhoneVerification&version=1.0.0&provider=admin"
Please follow this link to see all the api usage.
Thanks #thusharaK for providing help.
The solution was to add Message Mediation Policies which forces json header on output.
Now i got my correct response from API manager (in fact, i got a binary response in test console and a json response in postman) .