Using Redact Policy in API Connect 2018 - apiconnect

I have the below message from where I want to remove the field "Status Code"
{
"Details": {
"UT_LL": 22235,
"UT_ZZ": 512,
"Status Code": 206,
"UT_DATE": "2019-10-02-11.36.16.353965",
"UT_TOTAL_REC": 132
}
}
Appreciate your help as I am new to API connect. Also kindly note that I have already went through IBM portal and Knowledge center for the same use case..But none of those options work.

Not sure if you already solved, as it has been some time since this post. But nevertheless the solution for the wider community.
I was using API Connect 2018.4.1.9 (but should work same with earlier versions too) and was using DataPower API Gateway Service
1] I created a mock endpoint to respond with the above JSON data
2] Response w/o redact policy
{
"Details": {
"UT_LL": 22235,
"UT_ZZ": 512,
"Status Code": 206,
"UT_DATE": "2019-10-02-11.36.16.353965",
"UT_TOTAL_REC": 132
}
}
3] Response with redact policy. As you could see the Status Code field is removed (redacted), you could choose
{
"Details": {
"UT_LL": 22235,
"UT_ZZ": 512,
"UT_DATE": "2019-10-02-11.36.16.353965",
"UT_TOTAL_REC": 132
}
}
API Yaml file i used.
https://github.com/pramodvallanur/samples/blob/master/redact-sample.yaml

Related

Attempting to subscribe to a Shopify Webhook w/AWS EventBridge produces error: "Address is an AWS ARN and includes api_client_id 'x' instead of 'y'"

I'm running this request through Postman. Some posts to the Shopify developer forum (e.g., this one) express without clear explanation that the request should be made within the Shopify app that would be subscribing to the Webhooks, but Postman seems to work, too.
In Postman . . .
Here's the endpoint:
https://{{shopifyDevelopmentStoreName}}.myshopify.com/admin/api/2022-07/graphql.json
Here's the GraphQL body:
mutation createWebhookSubscription($topic: WebhookSubscriptionTopic!, $webhookSubscription: EventBridgeWebhookSubscriptionInput!) {
eventBridgeWebhookSubscriptionCreate(
topic: $topic,
webhookSubscription: $webhookSubscription
) {
webhookSubscription {
id
}
userErrors {
message
}
}
}
Here's the payload being sent (notice the "client_id_x" value within the arn property):
{
"topic": "PRODUCTS_CREATE",
"webhookSubscription": {
"arn": "arn:aws:events:us-east-1::event-source/aws.partner/shopify.com/client_id_x/LovecraftEventBridgeSource",
"format": "JSON",
"includeFields": "id"
}
}
Here's the response I receive:
{
"data": {
"eventBridgeWebhookSubscriptionCreate": {
"webhookSubscription": null,
"userErrors": [
{
"message": "Address is invalid"
},
{
"message": "Address is an AWS ARN and includes api_client_id 'client_id_x' instead of 'client_id_y'"
}
]
}
},
"extensions": {
"cost": {
"requestedQueryCost": 10,
"actualQueryCost": 10,
"throttleStatus": {
"maximumAvailable": 1000.0,
"currentlyAvailable": 990,
"restoreRate": 50.0
}
}
}
}
What's entirely unclear is why Shopify is insisting upon validity of "client_id_y" when, in AWS, the value being displayed is undeniably 'client_id_x'. Extremely confusing. I don't even see what difference using the Shopify app would make except that it produces a client_id value that works counter to one's expectations and intuitions.
Does anyone know why the heck Shopify isn't just using the client_id value of the event bus created earlier in Amazon EventBridge?
Same happend to me and I was lucky to find a solution.
The error message is just missleading.
I replaced the API Access Token for the Shopify Rest API Request (X-Shopify-Access-Token)
with the one from the Shopify App holding the aws credentials.
admin/settings/apps/development -> app -> API credentials -> Admin API access token. (can only be seen after creation)
Then I could subscribe webhooks to the app via the Rest Interface.

How do I fix the problem behind "THIRD_PARTY_AUTH_ERROR" when using Google's API Explorer to send a Firebase Cloud Messaging message?

I am trying to create a very simple Web app that can send and receive messages (including Push notifications) via Firebase Cloud Messaging. I want to try testing the ability to receive test messages sent from the Google API Explorer. However, I am running into a curious error as just about any API call from the relevant API URL will return the following error:
{
"error": {
"code": 401,
"message": "Auth error from APNS or Web Push Service",
"status": "UNAUTHENTICATED",
"details": [
{
"#type": "type.googleapis.com/google.firebase.fcm.v1.FcmError",
"errorCode": "THIRD_PARTY_AUTH_ERROR"
}
]
}
}
For reference, here is the message that I am trying to send:
{
"message": {
"token": "[FCM_TOKEN]",
"notification": {
"title": "New Notification",
"body": "Sample Text"
}
}
}
I also note that when I add "validate_only": true to the message, that the error goes away and the send request succeeds (though this is of no help, as that disables actually sending the message).
I am stumped, becuse the hint that pops up suggests that my OAuth2 credentials are invalid, though I leave the OAuth2 credential option checked and go through the authorization popup to provide my credentials.
Are you running the web app on Firefox, perhaps?
I have been running around my tail with this same issue for days now, and today I've found that there is an issue on Firefox, while this does work on Chrome:
Similar stack overflow question
The issue on the Firebase repository on Github
Although not a proper answer, I hope this helps.

Microsoft Graph API Invalid URI: The hostname could not be parsed. when using /search/query

I'm trying to search calendars by name with the v1.0/search/query endpoint from the Graph API. However even I'm trying the examples from the Explorer I get the following error:
{
"error": {
"code": "InternalServerError",
"message": "Invalid URI: The hostname could not be parsed.",
"innerError": {
"date": "2022-03-28T19:50:56",
"request-id": "ddb02afc-1c82-4884-d352-4a8d80809b20",
"client-request-id": "58147981-de34-ba11-ab1f-6e17dca603f9"
}
}
}
Graph Explorer:
Is this endpoint still supported? Is it not allowed for Applications?
From the output we can see that , in the tip its saying for adding the permissions for accessing Calendar events and its API's.
so please try to add those permissions and retry again. Please refer this DOC

A 400 error occurs when creating a OneDrive API upload session

Create an upload session to upload large files to oneDrive.
Below is the request address.
https://graph.microsoft.com/beta/users/{userId}/drive/root:/UploadFiles/{fileName}:/createUploadSession
Request Body
{
"item": {
"#odata.type": "microsoft.graph.driveItemUploadableProperties",
"#microsoft.graph.conflictBehavior": "rename",
"name": "largefile.dat"
}
}
An Invalid request error occurs. What's wrong with it? I watched the tutorial and tested it.
POST /drive/root:/{item-path}:/createUploadSession
Content-Type: application/json
{
"item": {
"#odata.type": "microsoft.graph.driveItemUploadableProperties",
"#microsoft.graph.conflictBehavior": "rename",
"name": "largefile.dat"
}
}
https://learn.microsoft.com/en-us/graph/api/driveitem-createuploadsession?view=graph-rest-beta#create-an-upload-session
As Shiva suggested in a comment on the question, the issue is that the value of #odata.type is not correct for this case. In general you should not provide it at all as the schema is strongly typed and therefore the appropriate value can be derived without any client-driven hints.

Pushwoosh can not delete message created by API

EDIT: as noted in the answer below, this was a problem on the pushwoosh side, it has been fixed!
When I create a push message through the pushwoosh API (using /createTargetedMessage) I'm not able to delete the message through the API. Messages made with the pushwoosh interface can be deleted through the API, no prob...
These are the steps I took to produce this error:
1. Create push message with the following params
{
"request":{
"auth":"AUTH TOKEN",
"send_date":"2015-09-22 15:07",
"content":{
"nl":"teststsdfgh",
"en":"teststsdfgh"
},
"devices_filter":"A(\"8A1EB-4E875\") * T(\"inholidaypark\", BETWEEN, [\"2015-09-22 00:00\",\"2015-09-22 23:59\"]) * T(\"Language\", IN, [\"nl\", \"en\"])"
}
}
2. This returns the following response; the messageCode is stored in our local DB for later use
{
"status":200,
"response":{
"status_code":200,
"status_message":"OK",
"response":
"messageCode":"D3F6-60769243-68B30EA8"
}
}
}
3. Call /deleteMessage with following data
{
"request":{
"auth":"AUTH TOKEN",
"message": "D3F6-60769243-68B30EA8"
}
}
4. API keeps returning:
{
"status_code": 210,
"status_message": "Message not found",
"response": null
}
But when I look at the push history the message is there (with the same messageCode and all). And it can be deleted through the pushwoosh interface, but not through the API.
On a side note: when the message is sent, we can obviously no longer delete it, then the API returns a more or less correct error:
{
"status_code": 210,
"status_message": "Forbidden",
"response": null
}
Just FYI for the rest of the readers, this issue has been identified and fixed on Pushwoosh side.
Move Along, Nothing to See Here. :)