how update woocommerce product meta_data with postman - woocommerce

how update woocommerce product meta_data with postman
please help update
{
"id": 15841,
"name": "LCD IPHONE 8G WHITE ORG CHIN",
"slug": "lcd-iphone-8g-white-org-chin",
"status": "publish",
"meta_data": [
{
"id": 452463,
"key": "_erp_code",
"value": "bBALOw92agF4QB4O"
},
{
"id": 464050,
"key": "_wp_old_date",
"value": "2022-05-12"
},
{
"id": 464051,
"key": "_holo_sku",
"value": "0118657"
},
{
"id": 464052,
"key": "_ipeir_woo_products_tabs",
"value": []
}
]
}
only update _holo_sku value
pust method in postman

This is well documented in the WooCommerce REST API docs. Search in Products > Update a product section (click here).
You need a PUT request to the products endpoint URL (replace your product ID):
/wp-json/wc/v3/products/<id>
Your $data should only contain the meta_data (only key and value, since id is redundant):
"meta_data": [
{
"key": "_holo_sku",
"value": "0118657"
},
]
WC REST API is fully integrated in Postman natively, so this should be pretty easy and straightforward.

Related

How to send event parameters for a tag through the google tag manager API

With this query i can create a GTM event tag for Google Analytics 4. i would like to pass some event parameters aswell. I feel that im really close because the API seems to recognize the eventParameters key, it tells me that its value its invalid.
"vendorTemplate.parameter.eventParameters[0]: The value is invalid.\n",
If i change this eventParameters key to something else, the query goes through (obviously without taking into consideration my eventParameters) so i know that this code has to be close.
The documentation is really shallow so building queries with the GTM api its been very trial and error until now.
When i get this working i'll probably make a sample for automating trigger and tag creation for GA4 migrations
`
{
"name": "test2",
"type": "gaawe",
"parameter": [
{
"type": "template",
"key": "eventName",
"value": "hey"
},
{
"type": "tagReference",
"value": "LocalTag",
"key": "measurementId"
},
{
"type": "list",
"key": "eventParameters",
"list": [
{
"type": "template",
"value": "page_title",
"key": "page_title"
}
]
}
]
}
`
The parameters is a array
Here is the example:
{
"type": "MAP",
"map": [
{
"type": "TEMPLATE",
"key": "name",
"value": `${parameterName}`
},
{
"type": "TEMPLATE",
"key": "value",
"value": `${parameterValue}`
}
]
}
And if you want to pass a variable to the value
Just add the "{{" , "}}" as you used in GTM UI.
Like {{DataLayer-Ecommerce}}
So yes you are very close to it.

How to add bulk products by WP WooCommerce API

I tried to add multiple product at once using WooCommerce API but I can't.
Can any one help me.
I successfully added single product but I can't add multiple. (When we go with single product method for huge volume, it's take long time. that's why)
I tried code posted below.
Reference doc:- https://woocommerce.github.io/woocommerce-rest-api-docs/v3.html?php#create-update-multiple-products
End point URL:- https://example.com/wp-json/wc/v3/products/bulk
Data:-
{
"create": [
{
"title": "Premium Quality22",
"type": "simple",
"regular_price": "77.99",
"description": "This is First product description from Balamurugan Ayyasamy",
"short_description": "This is First product description from Balamurugan Ayyasamy",
"categories": [
9,
14
],
"images": [
{
"src": "http://example.com/wp-content/uploads/2021/12/preview_1000-2009446955-2-547x365.jpg",
"position": 0
},
{
"src": "http://example.com/wp-content/uploads/2021/12/preview_1000-2009446955-2-547x365.jpg",
"position": 1
}
]
},
{
"title": "Premium Quality2",
"type": "simple",
"regular_price": "34.99",
"description": "This is second product description from Balamurugan Ayyasamy",
"short_description": "This is second product description from Balamurugan Ayyasamy",
"categories": [
9,
14
],
"images": [
{
"src": "http://example.com/wp-content/uploads/2021/12/preview_1000-1928542175.jpg",
"position": 0
},
{
"src": "http://dev.datanetiix.com/orange_coast/wp-content/uploads/2021/12/preview_1000-1928542175.jpg",
"position": 1
}
]
}
]
}'
I got this response when tried with postman (When I am tried using PHP curl function same result)
{
"code": "rest_no_route",
"message": "No route was found matching the URL and request method.",
"data": {
"status": 404
}
}
You're using the outdated WooCommerce API reference. Try to use this endpoint instead:
https://woocommerce.github.io/woocommerce-rest-api-docs/#batch-update-products

Getting all profiles from Google Analytics API

I'm trying to get all profiles using ~all option with this endpoint
https://www.googleapis.com/analytics/v3/management/accounts/~all/webproperties/~all/profiles
It doesn't return all profiles due to ~all for accounts. If I include account ID instead of ~all, then it returns profiles based on that account id - which are missing when used with ~all option.
https://www.googleapis.com/analytics/v3/management/accounts/89478503/webproperties/~all/profiles
Am I doing something wrong or is this GA API bug?
I sugst you look into using account summaries list
GET https://www.googleapis.com/analytics/v3/management/accountSummaries
This will return all the account information for a user.
{
"kind": "analytics#accountSummaries",
"username": "me#gmail.com",
"totalResults": 15,
"startIndex": 1,
"itemsPerPage": 1000,
"items": [
{
"id": "59183475",
"kind": "analytics#accountSummary",
"name": "Cube Analytics",
"webProperties": [
{
"kind": "analytics#webPropertySummary",
"id": "UA-59183475-1",
"name": "Cube Analytics",
"internalWebPropertyId": "93305066",
"level": "STANDARD",
"websiteUrl": "XXXXXXX",
"profiles": [
{
"kind": "analytics#profileSummary",
"id": "115455750",
"name": "Alaternate",
"type": "WEB"
},
{
"kind": "analytics#profileSummary",
"id": "97191919",
"name": "All Web Site Data",
"type": "WEB"
},
{
"kind": "analytics#profileSummary",
"id": "178538323",
"name": "MobileView",
"type": "APP"
}
]
}, ]
}
By using this call you should only need to make one call and get all of the information back.

How to check domain is verified using Google Analytics API?

I have used analytics.read in order to get user's sites and Google API response is:
{
"kind": "analytics#accountSummaries",
"username": "user#gmail.com",
"totalResults": 1,
"startIndex": 1,
"itemsPerPage": 1000,
"items": [
{
"id": "92159597",
"kind": "analytics#accountSummary",
"name": "MyNewDomain",
"webProperties": [
{
"kind": "analytics#webPropertySummary",
"id": "UA-92159597-1",
"name": "MyNewDomain",
"internalWebPropertyId": "236529827",
"level": "STANDARD",
"websiteUrl": "http://www.example.com",
"profiles": [
{
"kind": "analytics#profileSummary",
"id": "140745434",
"name": "All Web Site Data",
"type": "WEB"
}
]
}
]
}
]
}
Why there is no property related to domain status? How should I check whether domain is verified or not?
I tried to use siteverification scope for Google Verification API, it has the response that I need and it returns the list of verified domains but it has a scope of managing domains, so no one will actually grant access to our application in order to manage their domains and verify/un-verify domains.
Sample response:
{
"id": "string",
"site": {
"type": "string",
"identifier": "string"
},
"owners": [
"string"
]
}
How can I use analytics.read to get verified domains not unverified websites?

Marketo - How to save complex object in Lead Database?

I was asked to store leads like below in Marketo's lead database through rest api "POST /rest/v1/leads.json".
{
"action": "createOnly",
"lookupField": "email",
"input": [{
"email": "kjashaedd-1#klooblept.com",
"firstName": "Kataldar-1",
"postalCode": "04828",
"property": [{
"type": "land",
"status": "available"
},
{
"type": "car",
"status": "sold out"
},
{
"type": "bike",
"status": "sold out"
},
{
"type": "laptops",
"status": "available"
}
]
},
{
"email": "kjashaedd-2#klooblept.com",
"firstName": "Kataldar-2",
"postalCode": "04828",
"property": [{
"type": "land",
"status": "sold out"
},
{
"type": "car",
"status": "available"
},
{
"type": "bike",
"status": "sold out"
},
{
"type": "laptops",
"status": "available"
}
]
}
]
}
Input field is not in flat json structure. What could be the best approach? Do I really need to use custom objects in this case? Can I dump "property" object as it is in the lead database and use velocity script to parse it ?
If 'Property' is a custom object, you'll want to call that separately for the record and associated the record with that object via the custom object API
So you can push (create) the record first and then associate (add) the custom object to the record.
You can create a List<Dictionary<string,object>> in C# and retrieve the data and then store it using Entity Framework.
I am considering .Net framework in this case

Resources