I am trying to access an api function, for example I want to access the login function, I get the following error:
"message": "An internal error occurred during your request!",
Looking in the log file, the following log is there:
ERROR 2017-10-09 17:01:37,296 [11 ]
nHandling.AbpApiExceptionFilterAttribute - Processing of the HTTP
request resulted in an exception. Please see the HTTP response
returned by the 'Response' property of this exception for details.
System.Web.Http.HttpResponseException: Processing of the HTTP request
resulted in an exception. Please see the HTTP response returned by the
'Response' property of this exception for details.
I am using Postman to test. My URL is https://localhost:44347/api/Account/Authenticate. My header has Context-Type as "application/json" and in my Body I have the loginModel formatted as
{
"tenancyName": "tenantname",
"userNameOrEmailAddress": "admin",
"password": "123qwe"
}
Am not sure how else to proceed on this. Any ideas please? I have swagger installed as well.
I am using MVC + AngularJS template. I have not changed anything, just the default project.
Appreciate the assistance.
I have tested with Fiddler and it works correctly.
Note: make sure you type Content-Type correctly, on the question you typed Context-Type
Make a POST request! You may be missing this.
Related
Hi I'm trying to integrate paystack in laravel 8 but I'm click paynow button it give following error
Client error: POST https://api.paystack.co/transaction/initialize resulted in a 404 Not Found response:
{
"status": false,
"message": "Invalid Split code."
}
anyone can help how can i solve this
thanks
Can you share the request body? It looks like you're trying to pass a split code when you're initializing the transaction, but the code you're passing either:
Doesn't exist on that integration
Exists on the integration but maybe in test mode, and you're using your live keys (or in live mode and you're using your test keys)
I have tried below but http request got fails is there I missing something can anyone guide me please. In postman by using qnaId in the body I am getting the correspond queastion and answer in json response. The same I have tried in composer with Http request but it fails.
{
"qnaId" : "1164"
}
enter image description here
enter image description here
The same I tried in Postman and successfully got the response.
enter image description here
Thanks....
I think the issue is that $Qna is not a valid memory variable. Per documentation, you need to set this in either conversation, dialog, turn or user scopes. I had missed the section in the post here where the response was being set to $Qna. That's not valid. So, it needs something like turn.Qna or dialog.Qna.
Additionally, the use of $ should be used only for string interpolation, not in setting the variable name. turn.Qna would set it and you would utilize it in a string as: "You said: ${turn.Qna}"
I have returned Forbid() from a web request, and the browser claims its receiving a 404 instead of a 403.
I have added a handler to the cookie authentication like so...
o.Events.OnRedirectToAccessDenied += ctx =>
{
ctx.Response.StatusCode = (int)HttpStatusCode.Forbidden;
return Task.FromResult(0);
};
But this doesn't appear to be called.
Thus, why is a method that should return a 403 returning a 404?
I had the same issue. These were my steps to fix it:
Temporarily remove all the exception handling like app.UseExceptionHandler("/Home/Error") from Startup. In my case the 404 happened because the exception handling was broken.
Then I got the "real" error: My problem was that I had no authentication configured, and therefore no authentication schemes.
After I added the correct authentication options to Startup (in my case I used a custom authentication handler) I got the correct response code:
services.AddAuthentication(LicenseKeyAuthenticationOptions.Scheme)
.AddScheme<LicenseKeyAuthenticationOptions, LicenseKeyAuthenticationHandler>(LicenseKeyAuthenticationOptions.Scheme, null);
The Forbid() command seems to have an internal ASP.NET MVC controller redirect handling. In case you only want to provide a classic API and want 403 to be returned you should switch the command to
return StatusCode(StatusCodes.Status403Forbidden);
Don't forget to import the using
using static Microsoft.AspNetCore.Http.StatusCodes;
Source: https://stackoverflow.com/a/47708867/828184
So far I'm not aware if this behaviour of Forbid() could be changed.
I Just installed ELMAH 1.2.2 from nuget to my WebApi 2 (5.2.3) project. It logs errors but elmah.axd's stylesheet doesn't load. And WebApi shows the following error:
{
"message": "No HTTP resource was found that matches the request URI 'http://api.sample.dev/elmah.axd/stylesheet'.",
"messageDetail": "No type was found that matches the controller named 'elmah.axd'."
}
I read some answers but doesn't seems related to my case.
I solved this error by preventing the WebApi's routing from catching requests to *.axd.
You can add the following line to your routing config.
httpConfig.Routes.IgnoreRoute("DynamicResources", "{resource}.axd/{*pathInfo}");
Now you can access elmah.axd's stylesheet and have a well styled log report page.
I'm evaluating Canoo Webtest for automated integration/functional testing as a Grails plugin.
I have a REST app which I'm attempting to test, but Canoo Webtest doesn't seem to properly send the JSON data in POST request. My test code is like below
invoke( description:"Add a product to shopping cart",
url:'shoppingCart/add', method:'POST',
content:'{"class":"shop.service.Product", "name":"A product", "description":"Manufactured by X", "price":99.9}'
//contentFile: '../product.json'
)
The request body is empty no matter whether I use contentFile approach or inline the data as content attribute. The test report shows the data as being sent correctly, but error page shows an error stating 'JSONException: Missing value. at character 0 of '. JSON data as a response of GET request is coming back fine.
I have tested the same functionality with curl and it works perfectly fine. Is there something I'm missing in the Canoo Webtest setup?
Thanks.
EDIT: I'm using Grails 1.3.7 in case that makes any difference
OK. I started to just experiment with the invoke() and seems that setting attribute soapAction value to true does the trick.
I have no clue why this works. The documentation of invoke() for the attribute says
soapAction
Required? no
If the HTTP method is POST and is in fact a SOAP POST request,
this allows the SOAP Action header to be set. Ignored for GETs.
Apparently it sets some needed request header. Haven't checked which one.
Thank you for reading :)
Cannot yet mark this answer as the correct one, but will do so when it's possible.