How do you fix an abnormal message_id return from Firebase Cloud Messaging or what does it mean? - firebase-cloud-messaging

I'm getting a return like below with notifications not being received:
{
"multicast_id": 339554596924119421,
"success": 1,
"failure": 0,
"canonical_ids": 0,
"results": [{
"message_id": "0:1593443824341654%c4860296c4860296"
}]
}
When I expect a return like this one below, and a delivered notification:
{
"multicast_id": 1714438464855660605,
"success": 1,
"failure": 0,
"canonical_ids": 0,
"results": [{
"message_id": "1593203838780899"
}]
}
This issue is arising after deleting the firebase instance in app and getting a new token. What does the difference between message_id's mean or how does someone fix it?

Related

How to add query parameters in Zoom API (GET) request?

I'm trying to get all meeting recordings saved in the cloud in a date range using using the following API:
https://marketplace.zoom.us/docs/api-reference/zoom-api/cloud-recording/recordingslist
This is the API response I'm getting in postman.
{
"from": "2021-06-01",
"to": "2021-06-02",
"page_count": 1,
"page_size": 30,
"total_records": 1,
"next_page_token": "",
"meetings": [
{
"topic": "Meeting Room",
"type": 4,
"start_time": "2021-06-02T10:00:47Z",
"timezone": "Asia/Calcutta",
"duration": 0,
"total_size": 0,
"recording_count": 0,
"recording_files": [
{
"recording_start": "2021-06-02T10:02:39Z",
"recording_end": "2021-06-02T10:05:29Z",
"file_type": "MP4",
"file_extension": "MP4",
"file_size": 3181252,
"status": "completed",
"recording_type": "shared_screen_with_speaker_view"
},
{
"recording_start": "2021-06-02T10:02:39Z",
"recording_end": "2021-06-02T10:05:29Z",
"file_type": "M4A",
"file_extension": "M4A",
"file_size": 2694678,
"status": "completed",
"recording_type": "audio_only"
}
]
}
]
}
I am unable to get all the recordings of the desired time range. The "from" and "to" parameters are not changing even after trying the below query.
https://api.zoom.us/v2//users/me/recordings?from="2020-07-01"&to="2021-06-01"
In postman use this API
https://api.zoom.us/v2/users/{{user id}}/recordings?from=2022-01-01&meeting_id={{meeting id}}
Thanks to #ajaidanial

(CoinMarketCap) Different response from API call

Before the API was working properly but now it does not work well, its response got change and I don't know why
Previous response seems understandable:
Which the 2782 read as AUD and its name is properly assigned and does not return object on data property.
{
"status": {
"timestamp": "2021-04-20T00:35:36.456Z",
"error_code": 0,
"error_message": null,
"elapsed": 7,
"credit_count": 1,
"notice": null
},
"data": {
"id": 2782,
"symbol": "AUD",
"name": "Australian Dollar",
"amount": 88,
"last_updated": "2019-08-30T18:51:00.000Z",
"quote": {
"USDT": {
"price": 58.995907552127,
"last_updated": "2019-08-30T18:51:12.000Z"
}
}
}
}
Newer Response:
On this response the data property got a result of object which parent is the converted or symbol then its information, notice that the id and name does not match with 2782 (AUD). it became random string or something and also the conversion rate seems like not reasonable at all.
{
"status": {
"timestamp": "2021-05-20T08:25:05.561Z",
"error_code": 0,
"error_message": null,
"elapsed": 1,
"credit_count": 1,
"notice": null
},
"data": {
"AUD": {
"symbol": "AUD",
"id": "kg7up6o9tzp",
"name": "kz7fw7rlj8",
"amount": 88,
"last_updated": "2021-05-20T08:25:05.561Z",
"quote": {
"BTC": {
"price": 5691,
"last_updated": "2021-05-20T08:25:05.561Z"
}
}
}
}
}
This are the parameters I sent bot previous and newer call
{
"amount": 12,
"convert": "BTC",
"id": 2782 # AUD
}
UPDATE::
At some point when using the production version of API URL the result backs to normal
I don't know yet the explanation regarding on this issue, is there something limit on the sandbox api or so?

Zoho Inventory API json

When I run a test GET call in postman I get back the following json
"code": 0,
"message": "success",
"packages": [
{
"package_id": "1041677000009727045",
"salesorder_id": "1041677000009727003",
"shipment_id": "",
"customer_id": "1041677000007872931",
"customer_name": "TEST",
"status": "not_shipped",
"package_number": "PKG-00005",
"tracking_number": "",
"is_tracking_enabled": false,
"shipping_charge": 0,
"date": "2019-02-26",
"quantity": 1,
"salesorder_number": "SO-00023",
"created_time": "2019-02-26T16:13:11-0500",
"delivery_method": "",
"last_modified_time": "2019-02-26T16:13:11-0500",
"shipment_date": "",
"is_carrier_shipment": false,
"associated_packages_count": 0
},
],
"page_context": {
"page": 1,
"per_page": 200,
"has_more_page": false,
"report_name": "zom.common.Packages",
"applied_filter": "Status.All",
"custom_fields": [],
"sort_column": "created_time",
"sort_order": "D"
}
}
My issue is that the API request does not show line_items as shown in the documentation (https://www.zoho.com/inventory/api/v1/#Packages).
Does anyone know if the line_items exist but it just can't be seen as a json (e.g. I can update them but postman just cant view them?)
Had a support ticket in with Zoho but they haven't replied.
Try retrieving one package with the postman version of:
curl https://inventory.zoho.com/api/v1/packages/{package_id}
It should display the line_items per this documentation:
https://www.zoho.com/inventory/api/v1/packages/#retrieving-a-package

How to add the payment transaction status in order placed by using Demandware OCAPI?

I'm developing API for the mobile app of e-commerce website which is on Demandware. I am using the OCAPI 18.8 to place an order and send the payment details to third-party payment processor which is Vantiv. I get the transaction ID and response code from Vantiv and want to update my order to store these payment transaction details into my order. But I could not find any resource in OCAPI which let me add the transaction Id and response code received from Vantiv. Below is the order which I have placed through OCAPI:
{
"_v": "18.8",
"_type": "order",
"_resource_state": "xyz",
"adjusted_merchandize_total_tax": 0,
"adjusted_shipping_total_tax": 0,
"billing_address": {
"_type": "order_address",
"city": "Boston",
"country_code": "US",
"first_name": "John",
"full_name": "John Martin",
"id": "xyz",
"last_name": "Martin"
},
"channel_type": "storefront",
"confirmation_status": "not_confirmed",
"created_by": "Customer",
"creation_date": "2018-11-20T10:37:58.055Z",
"currency": "USD",
"customer_info": {
"_type": "customer_info",
"customer_id": "xyz",
"customer_name": "Ammar Shahbaz",
"customer_no": "xyz"
},
"customer_name": "Ammar Shahbaz",
"export_status": "not_exported",
"last_modified": "2018-11-20T10:37:58.376Z",
"merchandize_total_tax": 0,
"notes": {
"_type": "simple_link",
"link": "link"
},
"order_no": "123",
"order_token": "xyz",
"order_total": 299.8,
"payment_instruments": [
{
"_type": "order_payment_instrument",
"amount": 299.8,
"payment_card": {
"_type": "payment_card",
"card_type": "Visa",
"credit_card_expired": false,
"expiration_month": 1,
"expiration_year": 2021,
"holder": "John Doe",
"masked_number": "************4240",
"number_last_digits": "4240"
},
"payment_instrument_id": "xyz",
"payment_method_id": "CREDIT_CARD"
}
],
"payment_status": "not_paid",
"product_items": [
{
"_type": "product_item",
"adjusted_tax": 0,
"base_price": 149.9,
"bonus_product_line_item": false,
"gift": false,
"item_id": "xyz",
"item_text": "Long Sleeve Sequin Shift Dress",
"price": 299.8,
"price_after_item_discount": 299.8,
"price_after_order_discount": 299.8,
"product_id": "xyz",
"product_name": "Dress",
"quantity": 2,
"shipment_id": "xyz",
"tax": 0,
"tax_basis": 299.8,
"tax_class_id": "xyz",
"tax_rate": 0,
"c_cost": 25.17,
"c_finalSale": false,
"c_outlet": false,
"c_taxClassID": "xyz"
}
],
"product_sub_total": 299.8,
"product_total": 299.8,
"shipments": [
{
"_type": "shipment",
"adjusted_merchandize_total_tax": 0,
"adjusted_shipping_total_tax": 0,
"gift": false,
"merchandize_total_tax": 0,
"product_sub_total": 299.8,
"product_total": 299.8,
"shipment_id": "xyz",
"shipment_total": 299.8,
"shipping_address": {
"_type": "order_address",
"city": "Boston",
"country_code": "US",
"first_name": "John",
"full_name": "John Martin",
"id": "xyz",
"last_name": "Martin"
},
"shipping_method": {
"_type": "shipping_method",
"description": "Order received within 5-8 business days",
"id": "xyz",
"name": "Standard",
"price": 0,
"shipping_promotions": [
{
"_type": "shipping_promotion",
"callout_msg": "Free shipping on U.S. orders of $125+",
"link": "link",
"promotion_id": "xyz",
"promotion_name": "Free Shipping With $125 Purchase"
}
],
"c_BxFlatrateFlag": false,
"c_IsBorderlinxMethod": false
},
"shipping_status": "not_shipped",
"shipping_total": 0,
"shipping_total_tax": 0,
"tax_total": 0
}
],
"shipping_items": [
{
"_type": "shipping_item",
"adjusted_tax": 0,
"base_price": 0,
"item_id": "xyz",
"item_text": "Shipping",
"price": 0,
"price_after_item_discount": 0,
"shipment_id": "xyz",
"tax": 0,
"tax_basis": 0,
"tax_class_id": "xyz",
"tax_rate": 0
}
],
"shipping_status": "not_shipped",
"shipping_total": 0,
"shipping_total_tax": 0,
"site_id": "site name",
"status": "created",
"taxation": "net",
"tax_total": 0
}
I have tried this resource
Patch /orders/{order_no}/payment_instruments/{payment_instrument_id}
{
"amount" : 299.8,
"payment_card" : {
"number":"424459xxxxxx4240",
"security_code":"121",
"holder":"John Martin",
"card_type":"Visa",
"expiration_month":1,
"expiration_year":2021
},
"payment_method_id" : "CREDIT_CARD",
"c_PaymentProcessor": "VANTIV_CREDIT",
"c_paymentTransaction": {
"custom": {
"litleAFTresponse": "Approved",
"litleAFTTxnId": "8283868xxx8288282"
}
}
}
to update my order but no success.
Please let me know if you have any suggestion. Thanks.
If you have payment auth occurring outside of commerce cloud for some reason, you may be able to handle things in custom request document attributes. Note that there's an option to skip 'authorization' in CC by the skip_authorization parameter. eg:
POST /shop/v19_3/orders/00000027/payment_instruments?skip_authorization=true HTTP/1.1
Host: example.com
Authorization:Bearer eyJfdiI6IjXXXXXX.eyJfdiI6IjEiLCJleHAXXXXXXX.-d5wQW4c4O4wt-Zkl7_fiEiALW1XXXX
Content-Type: application/json
{
"amount": 49.99,
"payment_method_id": "MY_PAYMENT_METHOD",
"c_payment_token": "tokenvaluehere==",
"c_payment_status": "payment_status"
}
Then within your dw.ocapi.shop.order.payment_instrument.afterPOST you could add attributes to the Order's PaymentInstrument via the B2C API methods which are accessible via the callback's order parameter.
You'll want to check in the beforePOST hook to ensure that the c_payment_status param is an acceptable value and if not return a Status.ERROR type of status object. Then you can actually save the properties in the afterPOST hook where the objects you'll need are already created.
For example:
exports.paymentInstrumentAfterPOST = function(order, paymentInstrumentRequest) {
const PaymentTransaction = require('dw/order/PaymentTransaction');
const Status = require('dw/system/Status');
const Transaction = require('dw/system/Transaction');
let methodId = paymentInstrumentRequest.payment_method_id;
let instruments = order.getPaymentInstruments(methodId);
let instrument = instruments[0]; // FIXME you should actually iterate over this instead; just for demo
let paymentTransaction = instrument.getPaymentTransaction();
Transaction.begin();
paymentTransaction.setTransactionID(paymentInstrumentRequest.c_payment_token);
paymentTransaction.setType(PaymentTransaction.TYPE_AUTH);
Transaction.commit();
return new Status(Status.OK);
}
For more info on customizing the payment flow, see the Orders resource documentation
Disclaimer this is all code written free-hand in StackOverflow's answer form. I have not validated that this will actually run, but I hope it provides direction.
Internally in commerce cloud the below method call sets the transaction id: paymentInstrument.paymentTransaction.setTransactionID(anTransactionId) so your assumption is correct. This field is however not exposed in the shop API. From the documentation is is clear that the authorization of the payment should be triggered by commerce cloud. this is a security constraint. It is possible to customize the API to circumvent this limitation.
The platform itself has some internal workflows that you must follow step by step to complete an order via OCAPI Rest Api. You should follow the step by step workflow or if you don't find it ask your DW architect to guide you.
As of today, the platform provides a better way to handle this requirement. Under DATA API Endpoints you have now several entires to update overall order status, payment, shipment, or even shipping address. More details under official release notes:
You can now use Data API endpoints to update orders in server-to-server use cases, such as when an order management system or payment provider initiates a change.
Use new PUT commands to update the different types of order statuses.
PUT /sites/{site_id}/orders/{order_no}/confirmation_status
PUT /sites/{site_id}/orders/{order_no}/export_status
PUT /sites/{site_id}/orders/{order_no}/external_status
PUT /sites/{site_id}/orders/{order_no}/payment_status
PUT /sites/{site_id}/orders/{order_no}/shipping_status
PUT /sites/{site_id}/orders/{order_no}/status
Use a new PUT command to update an order’s shipping address.
PUT /sites/{site_id}/orders/{order_no}/shipments/{shipment_id}/shipping_address
Use new PATCH commands to update order and payment attributes.
PATCH /sites/{site_id}/orders/{order_no}
PATCH /sites/{site_id}/orders/{order_no}/payment_instruments/{payment_instrument_id}
PATCH /sites/{site_id}/orders/{order_no}/payment_instruments/{payment_instrument_id}/transaction
source: https://help.salesforce.com/articleView?id=sf.b2c_20_2_W6833203_ocapi_order_update_endpoints_as.htm&type=5

Restify very simple JSONClient returns empty json

I just started using restify and tries to build a very simple JSONClient and fails on the first step.
var restify = require('restify');
var client = restify.createJsonClient({
url: 'http://api.bgm.tv'
});
client.get('/calendar', function(err, req, res, obj) {
console.log('%j', obj);
});
This pieces of code returns {} with a status code 200
If you check http://api.bgm.tv/calendar in browser or curl it seems to be a legit json GET Rest API and does not require auth or anything else.
I tried other API such as stackoverflow api it works perfectly, so I assume something wrong with the server side?
If anyone can try to run it and help me point out what might went wrong would be very appreciated.
I runned your example node code and got a proper response (the same you get when browsing).
You probably have some version problem or a console.log size limitation.
Try using: console.log(obj[0]); it should print only the first object in the json.
I'm using node v0.8.9 and restify v2.4.1 on a mac.
Yeah, when I use the Postman plugin for Chrome and do a GET request to http://api.bgm.tv/calendar I get:
[
{
"weekday": {
"en": "Mon",
"cn": "星期一",
"ja": "月耀日",
"id": 1
},
"items": [
{
"id": 46458,
"url": "http://bgm.tv/subject/46458",
"type": 0,
"name": "アイカツ! -アイドルカツドウ!-",
"name_cn": "偶像活动",
"summary": "",
"eps": 0,
"air_date": "2012-10-08",
"air_weekday": 1,
"images": {
"large": "http://lain.bgm.tv/pic/cover/l/db/7f/46458_8mM39.jpg",
"common": "http://lain.bgm.tv/pic/cover/c/db/7f/46458_8mM39.jpg",
"medium": "http://lain.bgm.tv/pic/cover/m/db/7f/46458_8mM39.jpg",
"small": "http://lain.bgm.tv/pic/cover/s/db/7f/46458_8mM39.jpg",
"grid": "http://lain.bgm.tv/pic/cover/g/db/7f/46458_8mM39.jpg"
},
"collection": {
"wish": 0,
"collect": 0,
"doing": 44,
"on_hold": 0,
"dropped": 0
}
},
{
"id": 57150,
"url": "http://bgm.tv/subject/57150",
"type": 0,
"name": "LINE OFFLINE ~サラリーマン~",
"name_cn": "离线LINE - 上班族 -",
"summary": "",
"eps": 0,
"air_date": "2013-01-07",
"air_weekday": 1,
"images": {
"large": "http://lain.bgm.tv/pic/cover/l/71/28/57150_Kz171.jpg",
"common": "http://lain.bgm.tv/pic/cover/c/71/28/57150_Kz171.jpg",
"medium": "http://lain.bgm.tv/pic/cover/m/71/28/57150_Kz171.jpg",
"small": "http://lain.bgm.tv/pic/cover/s/71/28/57150_Kz171.jpg",
"grid": "http://lain.bgm.tv/pic/cover/g/71/28/57150_Kz171.jpg"
},
"collection": {
"wish": 0,
"collect": 0,
"doing": 206,
"on_hold": 0,
"dropped": 0
}
},
{
"id": 58709,
"url": "http://bgm.tv/subject/58709",
"type": 0,
"name": "ハヤテのごとく! Cuties",
"name_cn": "旋风管家 Cuties",
"summary": "",
"eps": 0,
"air_date": "2013-04-08",
"air_weekday": 1,
"images": {
"large": "http://lain.bgm.tv/pic/cover/l/15/28/58709_H7uj8.jpg",
"common": "http://lain.bgm.tv/pic/cover/c/15/28/58709_H7uj8.jpg",
"medium": "http://lain.bgm.tv/pic/cover/m/15/28/58709_H7uj8.jpg",
"small": "http://lain.bgm.tv/pic/cover/s/15/28/58709_H7uj8.jpg",
"grid": "http://lain.bgm.tv/pic/cover/g/15/28/58709_H7uj8.jpg"
},
"collection": {
"wish": 0,
"collect": 0,
"doing": 219,
"on_hold": 0,
"dropped": 0
}
},
...and a bunch more, but the body limit to answers on SO is 30,000 characters.