I got this response from webapp when login failed as Json:
{
"result": null,
"errorCode": "UNKNOWN_ERROR",
"message": "Bad credentials",
"responseCode": 400
}
How can i put those as Failed string to Hydra parameter (F=...)
Related
When I test self-service APIs, I found that there are 2 different formats for the error response.
case 1: when there is something wrong with token
I got such response
{
"errors": [
{
"code": "38190",
"title": "Invalid access token",
"detail": "The access token provided in the Authorization header is invalid",
"status": "401"
}
]
}
case 2: for other scenario such as INVALID DATE, MANDATORY DATA MISSING etc.
I got the error with another format
{
"errors": [
{
"code": 4926,
"title": "INVALID DATA RECEIVED",
"detail": "travelerType value is not in the allowed enumeration",
"source": {
"pointer": "/travelers[0]/travelerType",
"example": "ADULT"
},
"status": 400
}
]
}
The value of "code" and "status" have type string in case 1, but have type int in case 2.
Is it normal that the access token error has a particular error response format? Thanks
Need to understand why did the below query failed in GCP BigQuery. What are the possible reasons for failure?
The 3 DB cursors which failed for the script to ingest the data into Mongo:
All 3 were running on the same table, and they get authentication error:
{
"error": {
"code": 401,
"message": "Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.",
"errors": [
{
"message": "Login Required.",
"domain": "global",
"reason": "required",
"location": "Authorization",
"locationType": "header"
}
],
"status": "UNAUTHENTICATED"
}
}
I'm trying to export xlsx file from Podio following the documentation here.
But I received the following HTTP 400 response
{
"error_parameters": {},
"error_detail": null,
"error_propagate": false,
"request": {
"url": "http://api.podio.com/item/app/<fake_app_id>/export/xlsx",
"query_string": "",
"method": "POST"
},
"error_description": "Invalid value null (null): must be object",
"error": "invalid_value"
}
The error description is not very helpful. Any advice is much appreciated.
Fixed by passing an empty json {} in the post request body.
I have failed to add a new subscription webhook URL for my personal one drive Documents folder ( not a business account). The request response details is as follows.
URL: https://graph.microsoft.com/v1.0/subscriptions
Try 1
Request JSON:
{
"notificationUrl": "https://****.rest/OneDrive/newItemWebhook",
"expirationDateTime": "2017-09-18T11:23:00.000Z",
"resource": "/me/drive/root/Documents",
"changeType": "updated",
"clientState": "client-specific string"
}
Response JSON:
{
"error": {
"code": "BadRequest",
"message": "Unsupported segment type. ODataQuery:
users/****#outlook.com/drive/root/Documents",
"innerError": {
"request-id": "169755ee-bdf5-460e-8577-6f1e22777207",
"date": "2017-09-18T10:46:07"
}
}
}
Try 2
Request JSON:
{
"notificationUrl": "https://****.rest/OneDrive/newItemWebhook",
"expirationDateTime": "2017-09-18T11:23:00.000Z",
"resource": "/me/drive/root:/Documents",
"changeType": "updated",
"clientState": "client-specific string"
}
Response JSON:
{
"error": {
"code": "InvalidRequest",
"message": "resource '/me/drive/root:/Documents' is not supported.",
"innerError": {
"request-id": "403229b0-0554-46c2-82b8-ede69a4ef9a2",
"date": "2017-09-18T10:50:36"
}
}
}
In both cases the cases the failed to add subscription webhook URL but the reason in unknown to me, means what is :
Unsupported segment type. ODataQuery
resource '/me/drive/root:/Documents' is not supported.
and then if I want to set webhook URL for the above mention "resource" then what will be the path for my case!
Apparently, you cannot subscribe to changes in the particular folder, but to a drive, so you should subscribe to /me/drive/root. Then you could use driveitem delta api to track changes: https://learn.microsoft.com/en-gb/onedrive/developer/rest-api/api/driveitem_delta or use your own method (i.e. list files in the Documents folder)
Here is a bit outdated video explaining the process: https://channel9.msdn.com/Events/Build/2016/P566
I'm trying to control the presence of details in error responses from a Web API 2 OData v4 service. When I hit the OData service hosted on my local IIS, I get something like this:
{
"error": {
"code": "Error code",
"message": "Message from exception filter",
"details": [
{
"code": "Detail code",
"message": "Details here"
}
],
"innererror": {
"message": "Exception message here",
"type": "Exception type",
"stacktrace": "Stack trace here"
}
}
}
When I take the same service and deploy it on a remote server, and hit it with the same message, I get this:
{
"error": {
"code": "Error code",
"message": "Message from exception filter"
}
}
I'm guessing that the "innererror" and "details" sections are suppressed because I'm calling the service remotely? I'm happy that the "innererror" section is suppressed - I don't want to leak those details - but I want to expose the "details" section so that I can provide some more feedback on certain errors. Is there a simple way to achieve this?
Thanks!
I was creating my OData error responses using Request.CreateErrorResponse(myHttpStatusCode, myODataError). Looking at the source code of System.Web.Http.OData.Extensions.HttpRequestMessageExtensions.CreateErrorResponse, it appears that if Request.ShouldIncludeErrorDetail is false, then the ODataError is recreated with just the "code" and "message" items. My solution was to create another overload/extension of CreateErrorResponse which accepts a parameter that controls whether the details section should be included:
public static HttpResponseMessage CreateErrorResponse(this HttpRequestMessage request,
HttpStatusCode statusCode, ODataError oDataError, bool includeDetails)
{
if (request.ShouldIncludeErrorDetail())
{
return request.CreateResponse(statusCode, oDataError);
}
else
{
return request.CreateResponse(
statusCode,
new ODataError()
{
ErrorCode = oDataError.ErrorCode,
Message = oDataError.Message,
Details = includeDetails ? oDataError.Details : null
});
}
}
This allows the "innererror" section to be suppressed independently of the "details" section.