I'm getting this error
"error": {
"code": 400,
"source": "logic-apis-centralus.azure-apim.net",
"clientRequestId": "392138e8-1e84-42b0-997c-f08297a077c4",
"message": "The response is not in a JSON format.",
}
I'm also sending the message Id from http request and it was successfully parsed from request and set as a parameter in reply to email v3
It is able to get messageId from the request and then it tries to send reply to that particular email and it gives this error
Related
I am trying to see the data available in the ad_revenue_report_url which returns from the Applovin User Revenue API.
https://dash.applovin.com/documentation/mediation/reporting-api/user-ad-revenue
Here the sample request and response is:
https://r.applovin.com/max/userAdRevenueReport?api_key={REPORT_KEY}&date={REPORT_DAY}&platform={APP_PLATFORM}
&application={APP_PACKAGE_NAME}&store_id={APP_STORE_ID}&aggregated={IS_AGGREGATED}
header-link
Response:
{
"status": 200,
"url": "https://applovin-externalreports.s3.amazonaws.com/%2Fmediation_reports/report_date%3D1549756800/pub_id%3D12
345/mediation_app_id%3D12345/user_report.csv?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20190216T000208Z&X
-Amz-SignedHeaders=host&X-Amz-Expires=3599&X-Amz-Credential=dataio.amazon.s3.access_key%2F20190216%2Fus-east
-1%2Fs3%2Faws4_request&X-Amz-Signature=e45bdfbd88cbcf4e[...]927dd"
"ad_revenue_report_url": "https://applovin-externalreports.s3.amazonaws.com/%2Fmediation_reports/report_date%3D1549
756800/pub_id%3D12345/mediation_app_id%3D12345/user_report.csv?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=
20190216T000208Z&X-Amz-SignedHeaders=host&X-Amz-Expires=3599&X-Amz-Credential=dataio.amazon.s3.access_key%2
F20190216%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Signature=e45bdfbd88cbcf4e[...]927dd"
}
Here while I am hitting the URL which i got for my app it shows the error as SignatureDoesNotMatch
<Error>
<Code>SignatureDoesNotMatch</Code>
<Message>The request signature we calculated does not match the signature you provided. Check your key and signing method.</Message>
<AWSAccessKeyId>kfajdfhkajdfhakfhakf</AWSAccessKeyId>
<StringToSign>AWSsjdnsdsjkdnsdknsdksjdn</StringToSign>
<SignatureProvided>kjfdkjaf38348318413413</SignatureProvided>
<StringToSignBytes>13 133 131 13</StringToSignBytes>
<CanonicalRequest>GET//mediation_reports//report_date%SignedHeaders=host host:applovin-externalreports.s3.amazonaws.omUNSIGNED-PAYLOAD</CanonicalRequest>
<CanonicalRequestBytes></CanonicalRequestBytes>
<RequestId></RequestId>
<HostId>sR6VKZ/N+3G5VhhCOXLZdQaDvD4Z3gjT0th6/0Dh0Hv1+s=</HostId>
</Error>
To register a webhook on Dynamics 365 there is a tool called Plug-in Registration (https://learn.microsoft.com/en-us/powerapps/developer/data-platform/register-web-hook).
However, I would like to automate the webhook registration process and thus would like to use the Web API endpoint for webhook registration:
/api/data/v9.2/serviceendpoints
The problem I have is the setting of the value for the parameter authvalue in the JSON request body, because I want to use Http Header authtype:
{
"name": "Test Webhook",
"url": "https://myendpoint",
"contract": 8,
"authtype": 5,
"authvalue": "<========= ??? what comes here ???"
}
Assuming I want to have this header be sent to my webhook endpoint:
Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=
What would be the value of authvalue in the JSON above ?
The value should be a string according to the data type of authvalue, but how that should be formatted?
If I use the value Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ= as is for authvalue,
when the webhook is fired, I got the following error in System Job:
Plugin Trace:
[Microsoft.Crm.ServiceBus: Microsoft.Crm.ServiceBus.WebhookPlugin]
[ad9a4124-ab57-ec11-8f8f-6045bd8aed3b: Test for Step Creation]
Error Message:
System.ServiceModel.FaultException`1[Microsoft.Xrm.Sdk.OrganizationServiceFault]:
The webhook call failed because of invalid http headers in authValue.
Check if the authValue format, header names and values are valid for
your Service Endpoint entity. (Fault Detail is equal to Exception
details: ErrorCode: 0x80050203 Message: The webhook call failed
because of invalid http headers in authValue. Check if the authValue
format, header names and values are valid for your Service Endpoint
entity. TimeStamp: 2021-12-08T10:15:26.8637496Z
-- Exception details: ErrorCode: 0x80040216 Message: Received exception when adding custom http headers: for
OrgId:xxxxxx-925f-4958-9aee-xxxxxxxxxxxx, serviceEndpointId:
c099d16c-a057-ec11-8f8f-6045bd8aed3b, name: Test Webhook,
exception:System.Xml.XmlException: Data at the root level is invalid.
Line 1, position 1. at System.Xml.XmlTextReaderImpl.Throw(Exception
e) at System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace() at
System.Xml.XmlTextReaderImpl.ParseDocumentContent() at
System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean
preserveWhitespace) at System.Xml.XmlDocument.Load(XmlReader
reader) at System.Xml.XmlDocument.LoadXml(String xml) at
Microsoft.Crm.ServiceBus.WebhookClient.ExtractKe...).
For HtppHeader authentication type the key value pair for AuthValue must be set in the following xml format:
<settings><setting name="Authorization" value="Basic dXNlcm5hbWU6cGFzc3dvcmQ=" /></settings>
I am using API Gateway with lambda integration. I throw below error in my code:
throw new Error('[400] xxxx')
I didn't configure any response template in API gateway so the client will receive this error:
{
"errorType": "Error",
"errorMessage": "[400] Customer's id 1234 doesnt exist.",
"trace": [
"Error: [400] Customer's id 1234 doesnt exist.",
" at CustomerService.<anonymous> (/var/task/src/services/base/baseService.js:71:31)",
" at Generator.next (<anonymous>)",
" at fulfilled (/var/task/src/services/base/baseService.js:5:58)",
" at processTicksAndRejections (internal/process/task_queues.js:97:5)"
]
}
what I really want them to see is Customer's id 1234 doesnt exist.. How can I use response template to filter out other attributes and the bracket [400] from errorMessage?
You should be able to do something like the below mapping (which needs to be mapped to a 400 status code that you create). You would also need to "match" the request, maybe something like: .*\[400\]*:
#set($inputRoot = $input.path('$'))
{
## Assign output properties to input properties
"message": "$inputRoot.errorMessage"
}
or even more simplified:
{
"message": $input.json('$.errorMessage')
}
I am working on a Microsoft Graph API app where i want to delete email messages from the inbox.
I do that by first getting the emails, putting the id from each email in an array and for each id in that array making a delete request to remove it from the inbox.
When I try and run my code i get the error
Error: Server responded to *request link* with status code 403:
{
"error": {
"code": "ErrorAccessDenied",
"message": "Access is denied. Check credentials and try again.",
"innerError": {
"request-id": "*request id*",
"date": "2020-06-03T09:12:06"
}
}
}
When making the delete request I pass in the same Access Token that i use to make the get request for getting the email data.
Here is my code:
// This is only the code for the delete request, passing the Access Token works aswell as passing the IDList array. It loops trough all the id's and tries to make a request. But the request fails
removeEmail(IDList, AccessToken);
function removeEmail(idList, accessToken) {
idList.forEach(ID => {
var deleteEmails = request('DELETE', `https://graph.microsoft.com/v1.0/me/messages/${ID}`, {
headers: {
'Authorization': `Bearer ${accessToken}`
}
});
deletedEmails = JSON.parse(deleteEmails.getBody('utf8'));
console.log(deleteEmails);
});
}
How can this be fixed so that it removes the messages from the inbox without any problems?
Thanks in advance!
What permissions have you added to your Microsoft Graph API app?
Deleting an email requires Mail.ReadWrite - https://learn.microsoft.com/en-us/graph/api/message-delete?view=graph-rest-1.0&tabs=http
On the other hand, getting a list of messages works with the following permissions - Mail.ReadBasic, Mail.Read, Mail.ReadWrite - https://learn.microsoft.com/en-us/graph/api/user-list-messages?view=graph-rest-1.0&tabs=http#permissions
To be able to both read and delete email messages, you need Mail.ReadWrite added to your app.
when sending push messages through fcm (through nodejs firebase admin sdk), getting this error structure:
{
"results": [
{
"error": {
"code": "messaging/invalid-registration-token",
"message": "Invalid registration token provided. Make sure it matches the registration token the client app receives from registering with FCM."
}
}
],
"canonicalRegistrationTokenCount": 0,
"failureCount": 1,
"successCount": 0,
"multicastId": SOME_ID
}
Is the index of the results relates to the index of the token array that was sent to firebase?
Yes, as described here:
results Array of objects representing the status of the messages processed. The objects are listed in the same order as the request (i.e., for each registration ID in the request, its result is listed in the same index in the response).