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
We are currently using a GTM template provided by an advertising firm. We intend to no longer use this firm but would like to keep the same tags in place. We don't want our data being sent back to them as a result of the GTM template. I have taken out any sensitive information but would like to know which values to remove or change.
The Template URL under Add to Cart would obviously need to be changed but what about container id or path? Are these just informational concerning the account that exported this file or does this pass data back to their account? The specified tagManagerUrl does not match my account.
Anything else to look out for? I have attached a small segment of the file.
Thank you
{
"exportFormatVersion": 2,
"exportTime": "2019-01-10 11:11:11",
"containerVersion": {
"path": "accounts/XXX/containers/XXX/versions/0",
"accountId": "XXX",
"containerId": "XXX",
"containerVersionId": "0",
"container": {
"path": "accounts/XXX/containers/XXX",
"accountId": "XXX",
"containerId": "XXX",
"name": "the Container",
"publicId": "GTM-XXX",
"usageContext": [
"WEB"
],
"fingerprint": "XXX",
"tagManagerUrl": "https://tagmanager.google.com/#/container/accounts/XXX/containers/XXX/workspaces?apiLink=container"
},
"tag": [
{
"accountId": "XXX",
"containerId": "XXX",
"tagId": "10",
"name": "Add Item to Cart",
"type": "img",
"parameter": [
{
"type": "BOOLEAN",
"key": "useCacheBuster",
"value": "true"
},
{
"type": "TEMPLATE",
"key": "url",
"value": "https://AdVendorURL/xxx/item?&XXX"
},
{
"type": "TEMPLATE",
"key": "cacheBusterQueryParam",
"value": "gtmcb"
}
],
"fingerprint": "XXX",
"firingTriggerId": [
"7"
],
"tagFiringOption": "ONCE_PER_EVENT",
"monitoringMetadata": {
"type": "MAP"
}
},
I would not remove anything from the template. In your Google Tag Manager container go to Admin > Import Container and follow the instructions to import the configuration. Once you have complete go to your Workspace and select Tags from the menu. Locate the tag Add Item to Cart and remove it.
I am attempting to create a product with variations in WooCommerce but I am getting this error:
{u'message': u'No route was found matching the URL and request method', u'code': u'rest_no_route', u'data': {u'status': 404}}
when I run the create_variation function from the API.
I ran a GET on the attributes for the product I created and it found no attributes even though the printed response when I created the product had the attributes listed.
Here is my code to create the variable product:
data = {
"name": row[3],
"type": "variable",
"description": row[4],
"images": [
{
"src": row[15],
"position": 0
}
],
"in_stock": True,
"sku": row[2],
'attributes': [
{
'name': 'Size',
'variation': True,
'visible': True,
'options': sizeList,
},
{
'name': 'Color',
'variation': True,
'visible': True,
'options': colorList,
}
],
}
print(wcapiNew.post("products", data).json())
Here is my code to create the variations:
result = wcapi.get("products/sku/"+row[2]).json()
product_id = result['product']['id']
variationData = {
"regular_price": row[17],
"image": {
"src": row[13]
},
"sku": row[19],
"attributes": [
{
"name": "Color",
"option": row[6]
},
{
"name": "Size",
"option": row[10]
}
]
}
print(wcapiNew.post("products/"+str(product_id)+"/variations", variationData).json())
I've been tearing my hair out trying to figure out what I'm doing wrong but I'm clueless right now.
Any help is appreciated. Thanks.
This is my variations data, and it work.
data_1 = {
"regular_price": "9.00",
"sku": "premium-quality-101-red",
"attributes": [
{
"id": 1,
"option": "Red"
}]
}
I figure out that you need to use id, and update one variation at a time.
I have taken the Blog App, added a Category ContentType as a field in the BlogPost ContentType and built a query to factor Category into the results.
But I am having trouble with the In-ValueProvider. Following the example here the Visual Query Designer seems to be ignoring the incoming value from my ModuleDataSource.
I have double checked the In-Stream name, my Entity names, case, TestParameters, etc. Are there any known bugs in 2sxc 8.44 and up that would cause this issue? What have I missed?
In this case I am using a RelationshipFilter. Relationship is "Category". Filter is "[In:Config:Category]". I can switch out to a [Querystring:Category] and that works fine and runs all my code.
Thanks for reading.
OK I found a workaround.
It turns out that the In-ValueProvider is working but it's struggling with the Category of my BlogPost I think because Category is an entity.
For background I have a BlogPost ContentType, a Category ContentType, and an Articles Home Header ContentType. Articles Home Header sets both the header info for the articles page and the Category entity.
For some reason the RelationshipFilter is having trouble comparing the Category entities between Articles Home Header and BlogPost. I tried the following for my Filter and neither worked:
[In:Config:Category]
[In:Config:Category:Title]
I wonder if this is a case sensitivity issue, a bug, or if I am just misunderstanding the filter syntax.
To work around I created a temp field called TempCategory in my Articles Home Header and used [In:Config:TempCategory] for the filter.
That worked.
For reference here is a snippet from the Query:
{
"Config": [
{
"Title": "Coaching Articles",
"SubTitle": "",
"Image": "/Portals/0/uploadedimages/AcademicPrograms/Christ_College/crosswise-hero.jpg",
"ImageAlt": "Crosswise stained glass",
"Category": [
{
"Id": 2716,
"Title": "Coaching"
}
],
"Id": 3118,
"Modified": "2016-06-21T10:44:21.9Z",
"_2sxcEditInformation": {
"sortOrder": 0
}
}
],
"Paging": [
{
"Title": "Paging Information",
"PageSize": 10,
"PageNumber": 1,
"ItemCount": 0,
"PageCount": 0,
"Id": 0,
"Modified": "0001-01-01T00:00:00Z",
"_2sxcEditInformation": {
"entityId": 0,
"title": "Paging Information"
}
}
],
,
"Default": [
{
"Title": "Protect Your Players and Your Program: An Athletic Leader's Legal Duties",
"UrlKey": "an-athletic-leaders-legal-duties",
"PublishingGroup": null,
"PublicationMoment": "2016-06-15T00:00:00Z",
"Image": "/Portals/0/uploadedimages/AcademicPrograms/Graduate/Coaching/an_athletic_leaders_legal_duty.jpg",
"ImageSquare": false,
"Teaser": "<p>When the clock started on the new year earlier this month, all but one state joined the growing legal effort to protect and prevent concussions and head injuries among America’s young.</p>",
"Body": "<p><strong>When the clock started on the new year earlier this month,</strong> all but one state joined the growing legal effort to protect and prevent concussions and head injuries among America’s young.</p>\n<p>As sports-related injuries and issues continue to dominate the headlines and influence programs throughout the country, laws like “return-to-play” are becoming a sign of the times when it comes to protecting players and athletic programs alike. The world of athletics is experiencing a significant shift in the perception of the roles and responsibilities of coaches, schools and athletic personnel.</p>",
"DesignedContent": [],
"Tags": [
{
"Id": 2576,
"Title": "coaching"
},
{
"Id": 2575,
"Title": "management"
},
{
"Id": 2574,
"Title": "sports"
},
{
"Id": 3035,
"Title": "legal"
}
],
"Author": [
{
"Id": 3030,
"Title": "Shaleek Blackburn"
}
],
"ImageAlt": "Referee holding a red",
"Thumbnail": "",
"ThumbnailAlt": "",
"RelatedArticles": [
{
"Id": 2564,
"Title": "Athletic Personnel's Duty To Warn"
},
{
"Id": 2565,
"Title": "Get A Better Grip On Bullying"
},
{
"Id": 2717,
"Title": "Good Coaching Develops Exceptional Athletes and People"
}
],
"Category": [
{
"Id": 2716,
"Title": "Coaching"
}
],
"ArticleRelationships": null,
"Id": 2513,
"Modified": "2016-06-15T19:32:17.913Z",
"_2sxcEditInformation": {
"entityId": 2513,
"title": "Protect Your Players and Your Program: An Athletic Leader's Legal Duties"
}
}
]
}
We are moving to Alfresco Content Management system and there is no direct documentation for retrieving custom metadata.
Is there a way to get custom metadata/ custom properties that I have added to Record category in Alfresco Records Management File plan? Custom metadata is basically the data fields that are in scanned document like name, dob, form id, etc.
Eg: I have created RM site and added the following file plan.
TestCategory
|
--TestFolder1
|
--Record1
--Record2
|
--TestFolder2
|
--Record1
--Record2
These records contains uploaded form(scanned document) along with metadata (custom).
To Retrieve metadata, am using
http://127.0.0.1:8090/alfresco/service/api/metadata/node/workspace/SpacesStore/ed6e2cc6-6dc5-4bfb-bf9d-b450f68863dd?alf_ticket=TICKET_06265902898618fe5a46e67992e07a9d4b72701a
It is returning 405-Method not allowed (GET not supported).
To Retrieve all the subfolders/documents in Folders, m using
http://127.0.0.1:8090/alfresco/service/slingshot/doclib/doclist/documents/site/rm/documentLibrary/TestCat1/TestFolder2
Above one returns
{
"totalRecords": 1,
"startIndex": 0,
"metadata": {
"repositoryId": "3b9d4f67-dc84-4531-b8b2-4dbcef15e25a",
"container": "workspace://SpacesStore/7d1349bb-5289-4709-9055-c75c03ab5481",
"parent": {
"nodeRef": "workspace://SpacesStore/5d40660e-64d9-4bc4-a75e-ae4ae8b2201a",
"permissions": {
"userAccess": {
"create": true,
"edit": true,
"delete": true,
"cancel-checkout": false,
"permissions": true
}
}
},
"onlineEditing": true,
"itemCounts": {
"folders": 0,
"documents": 1
}
},
"items": [
{
"nodeRef": "workspace://SpacesStore/65b9b52b-3418-4a85-98b0-d4770cf9399d",
"nodeType": "cm:content",
"type": "document",
"mimetype": "application/pdf",
"isFolder": false,
"isLink": false,
"fileName": "BO (2016-1464237424392).pdf",
"displayName": "BO (2016-1464237424392).pdf",
"status": "",
"title": "þÿ",
"description": "test description",
"author": "",
"createdOn": "2016-05-26T00:37:04.350-04:00",
"createdBy": "Administrator",
"createdByUser": "admin",
"modifiedOn": "2016-05-31T15:50:21.269-04:00",
"modifiedBy": "Administrator",
"modifiedByUser": "admin",
"lastThumbnailModification": "doclib:1464237426243",
"lockedBy": "",
"lockedByUser": "",
"size": "156702",
"version": "1.0",
"contentUrl": "api/node/content/workspace/SpacesStore/65b9b52b-3418-4a85-98b0-d4770cf9399d/BO%20(2016-1464237424392).pdf",
"webdavUrl": "/webdav/Sites/rm/documentLibrary/TestCat1/TestFolder2/BO%20(2016-1464237424392).pdf",
"actionSet": "document",
"tags": [],
"activeWorkflows": "",
"isFavourite": false,
"likes": {
"isLiked": false,
"totalLikes": 0
},
"location": {
"repositoryId": "3b9d4f67-dc84-4531-b8b2-4dbcef15e25a",
"site": "rm",
"siteTitle": "Records Management",
"container": "documentLibrary",
"path": "/TestCat1/TestFolder2",
"file": "BO (2016-1464237424392).pdf",
"parent": {
"nodeRef": "workspace://SpacesStore/5d40660e-64d9-4bc4-a75e-ae4ae8b2201a"
}
},
"permissions": {
"inherited": true,
"roles": [
"ALLOWED;ROLE_EXTENDED_READER;ReadRecords;INHERITED",
"ALLOWED;GROUP_Administrator7d1349bb-5289-4709-9055-c75c03ab5481;Filing;INHERITED",
"ALLOWED;ROLE_EXTENDED_WRITER;Filing;INHERITED"
],
"userAccess": {
"create": true,
"edit": true,
"delete": true,
"cancel-checkout": false,
"permissions": true
}
},
"custom": {},
"actionLabels": {}
}
]
}
Using PostMan chrome app to test rest api. TIA.
Another way to do this: I found it in Alfresco forums :
/alfresco/service/api/metadata?nodeRef=workspace://SpacesStore/a2a6c249- c55d-4d29-8692-3e9cb1f811a8 [GET service]
This should do it. Example request.
http://localhost:8080/alfresco/service/slingshot/doclib2/node/workspace/SpacesStore/f558838b-24fa-4ea3-bb2a-602c7b4cec41
Give it a shot, it will return everything you need, not only metadata but for example aspects too.
If the response you are getting is overwhelming for anyone like me, in the accepted (great) answer/solution given by Lista, here is a simpler way:
HTTP GET:
http://localhost:8080/alfresco/api/-default-/public/alfresco/versions/1/nodes/dc2d0a1b-a78d-47a9-aaab-31df0f09e8fb
Need some more details? Try this:
http://localhost:8080/alfresco/api/-default-/public/alfresco/versions/1/nodes/dc2d0a1b-a78d-47a9-aaab-31df0f09e8fb?include=association,path,permissions
You will get a response similar to this:
{"entry":{"isFile":true,"createdByUser":{"id":"admin","displayName":"Administrator"},"modifiedAt":"2020-12-16T00:01:56.615+0000","nodeType":"cm:content","content":{"mimeType":"application/pdf","mimeTypeName":"Adobe PDF Document","sizeInBytes":8037,"encoding":"UTF-8"},"parentId":"c250f9c5-d3f9-4c9e-83c6-2d239f8c2237","aspectNames":["cm:versionable","cm:titled","cm:auditable","cm:taggable","cm:author"],"createdAt":"2020-12-13T16:48:27.600+0000","isFolder":false,"modifiedByUser":{"id":"admin","displayName":"Administrator"},"name":"fileName","id":"dc2d0a1b-a78d-47a9-aaab-31df0f09e8fb","properties":{"cm:title":"titletest","cm:versionType":"MAJOR","cm:versionLabel":"1.0","cm:description":"descriptiontest"}}}
And with include options the response will look similar to this -
{"entry":{"isFile":true,"createdByUser":{"id":"admin","displayName":"Administrator"},"modifiedAt":"2020-12-16T00:01:56.615+0000","association":{"isPrimary":true,"assocType":"cm:contains"},"nodeType":"cm:content","content":{"mimeType":"application/pdf","mimeTypeName":"Adobe PDF Document","sizeInBytes":8037,"encoding":"UTF-8"},"parentId":"c250f9c5-d3f9-4c9e-83c6-2d239f8c2237","aspectNames":["cm:versionable","cm:titled","cm:auditable","cm:taggable","cm:author"],"createdAt":"2020-12-13T16:48:27.600+0000","path":{"name":"/Company Home/Sites/site1/documentLibrary/Employee/Test","isComplete":true,"elements":[{"id":"3ac0f350-a3e0-4da4-8dfa-c8e74553b024","name":"Company Home","nodeType":"cm:folder","aspectNames":["cm:titled","cm:auditable","app:uifacets"]},{"id":"15d878c2-e880-4a3f-ac00-60596ba2dcd1","name":"Sites","nodeType":"st:sites","aspectNames":["cm:titled","cm:auditable","app:uifacets"]},{"id":"46c2a6b1-2839-4b25-ac5d-c7dd874aea1e","name":"site1","nodeType":"st:site","aspectNames":["cm:tagscope","cm:titled","cm:auditable"]},{"id":"e8bc3bfe-7b41-416e-aa6a-9ee1b4fc9779","name":"documentLibrary","nodeType":"cm:folder","aspectNames":["cm:tagscope","st:siteContainer","cm:ownable","cm:titled","cm:auditable"]},{"id":"d5027ba7-874c-4996-bcde-923c68ec4c5b","name":"Employee","nodeType":"cm:folder","aspectNames":["cm:titled","cm:auditable"]},{"id":"c250f9c5-d3f9-4c9e-83c6-2d239f8c2237","name":"Test","nodeType":"cm:folder","aspectNames":["cm:titled","cm:auditable"]}]},"isFolder":false,"permissions":{"inherited":[{"authorityId":"GROUP_EVERYONE","name":"SiteConsumer","accessStatus":"ALLOWED"},{"authorityId":"GROUP_EVERYONE","name":"ReadPermissions","accessStatus":"ALLOWED"},{"authorityId":"GROUP_site_site1_SiteConsumer","name":"SiteConsumer","accessStatus":"ALLOWED"},{"authorityId":"GROUP_site_site1_SiteManager","name":"SiteManager","accessStatus":"ALLOWED"},{"authorityId":"GROUP_site_site1_SiteCollaborator","name":"SiteCollaborator","accessStatus":"ALLOWED"},{"authorityId":"GROUP_site_site1_SiteContributor","name":"SiteContributor","accessStatus":"ALLOWED"}],"settable":["Contributor","Collaborator","Coordinator","Editor","Consumer"],"isInheritanceEnabled":true},"modifiedByUser":{"id":"admin","displayName":"Administrator"},"name":"fileName","id":"dc2d0a1b-a78d-47a9-aaab-31df0f09e8fb","properties":{"cm:title":"titletest","cm:versionType":"MAJOR","cm:versionLabel":"1.0","cm:description":"descriptiontest"}}}
Disclaimer: I am using Alfresco 6.2 Community Edition. But as per documentation (public rest-api link) it says:
Note: this endpoint is available in Alfresco 5.2 and newer versions.