// Before running the sample:
// - Enable the API at:
// https://console.developers.google.com/apis/api/content.googleapis.com
// - Login into gcloud by running:
// `$ gcloud auth application-default login`
// - Install the npm module by running:
// `$ npm install googleapis`
const {google} = require('googleapis');
const content = google.content('v2.1');
async function main() {
const auth = new google.auth.GoogleAuth({
// Scopes can be specified either as an array or as a single, space-delimited string.
scopes: ['https://www.googleapis.com/auth/content'],
});
// Acquire an auth client, and bind it to all future calls
const authClient = await auth.getClient();
google.options({auth: authClient});
// Do the magic
const res = await content.ordertrackingsignals.create({
// The ID of the merchant for which the order signal is created.
merchantId: 'placeholder-value',
// Request body metadata
requestBody: {
// request body parameters
// {
// "customerShippingFee": {},
// "deliveryPostalCode": "my_deliveryPostalCode",
// "deliveryRegionCode": "my_deliveryRegionCode",
// "lineItems": [],
// "merchantId": "my_merchantId",
// "orderCreatedTime": {},
// "orderId": "my_orderId",
// "orderTrackingSignalId": "my_orderTrackingSignalId",
// "shipmentLineItemMapping": [],
// "shippingInfo": []
// }
},
});
console.log(res.data);
// Example response
// {
// "customerShippingFee": {},
// "deliveryPostalCode": "my_deliveryPostalCode",
// "deliveryRegionCode": "my_deliveryRegionCode",
// "lineItems": [],
// "merchantId": "my_merchantId",
// "orderCreatedTime": {},
// "orderId": "my_orderId",
// "orderTrackingSignalId": "my_orderTrackingSignalId",
// "shipmentLineItemMapping": [],
// "shippingInfo": []
// }
}
main().catch(e => {
console.error(e);
throw e;
});