Is that possible to update the inventory/stock quanitity in bulk using WooCommerce API? From the documentation for every update we may need to call PUT /wp-json/wc/v3/products/. We have more than 1000 products, it is very inefficiency to call 1000+ api just to update the quatity?
If there is any other thoughts, please welcome to share. Thanks
You can use this endpoint wp-json/wc/v3/products/batch
{
"Update": [
{
"Id": "39",
"Default_attributes": [
{
"Id": null,
"Name": null,
"Sku": "NEW-SKU",
"StockQuantity": "5"
}
]
}
]
}
here is an example body
Related
I'm interested in the value of one field (Module ID) but there seems to be no way of obtaining this specifically. A complete dump of all field values would also suffice but I haven't succeeded in finding a way to do that either. I've looked at and tried the searches available within the documentation here: https://www.jfrog.com/confluence/display/JFROG/Artifactory+REST+API#ArtifactoryRESTAPI-SEARCHES
If it helps, I'm trying to query an on-premise installation of Artifactory.
More fields can be added to the AQL using the "include" element.
For example - to list all artifacts under "libs-release-local" repository, including their module names, run the following query:
items.find(
{
"repo":{"$eq":"libs-release-local"}
}
).include("artifact.module")
Response example:
{
"results": [
{
"repo": "libs-release-local",
"path": "org/jfrog/test/multi2/2.17.0",
"name": "multi2-2.17.0.jar",
"type": "file",
"size": 1022,
"created": "2021-09-11T13:51:33.878Z",
"created_by": "deployer",
"modified": "2021-09-11T13:51:33.631Z",
"modified_by": "deployer",
"updated": "2021-09-11T13:51:33.881Z",
"artifacts": [
{
"modules": [
{
"module.name": "org.jfrog.test:multi2:2.17.0"
}
]
}
]
}
]
}
You can find all of the required information under AQL documentation.
I've stubled upon an issue for updating order line items' metadata via WooCommerce REST API using node.js.
I've been following these steps for updating orders (and was succesful with some fields):
https://woocommerce.github.io/woocommerce-rest-api-docs/#update-an-order
Now, what I would like to achieve is changing the number of shipped line items of an order. Something I would normally use the partial orders WC plugin in the wordpress UI.
Below, you can find a screenshot of a line item I get from WC using the orders API call. The last element of the meta_data array has key 'shipped' and it contains an array with one object, stating that one (out of two ordered items) had been shipped:
"line_items": [{
"id": 1937,
"name": "Maya",
"product_id": 1271,
"variation_id": 1272,
"quantity": 2,
"tax_class": "",
"subtotal": "140.00",
"subtotal_tax": "0.00",
"total": "140.00",
"total_tax": "0.00",
"taxes": [],
"meta_data": [{
"id": 21637,
"key": "pa_product-color",
"value": "beige"
}, {
"id": 21638,
"key": "pa_shoe-size",
"value": "42"
}, {
"id": 21639,
"key": "pa_shoe-width",
"value": "wide"
}, {
"id": 21640,
"key": "shipped",
"value": [{
"qty": 1,
"date": "Nov 21, 2017"
}
]
}
],
"sku": "2522BE42W",
"price": 70
},
As you can see, the value of the key 'shipped' is an object. When I ty to send it (back) to WC, I get an error saying:
"data":{"status":400,"params":{"line_items":"line_items[0][meta_data][3][value] is not of type string."}}}
When I try to send the value as a string, i.e.
lineItems[0].meta_data = [{key:"shipped", value: "[{qty:'2'}]" }]
I get no errors, but WC treats this as string, not as an object and doesn't update the shipment qty in the DB the way I intended (it only pulls the shipped quantity down to 0 instead):
{
"id": 21640,
"key": "shipped",
"value": "[{qty:'2'}]"
}
Any insights or ideas - how could I modify the shipped quantity of line items via the WC API?
So, apparently there was a bug in WP 4.9 version, which was fixed recently in the following commit:
https://github.com/woocommerce/woocommerce/pull/17849
It concerns REST API schema and after merging the fix to WooCommerce, the problems disappear and now I am able to send the data as an object.
More on the topic can be found here:
https://github.com/woocommerce/wc-api-dev/pull/74
I'm attempting make a query in a field that is list of key-value, as below.
Unfortunatelly I'm novice in DynamoDB, sorry.
My goal is get a record using a filter like:
Where
TransactionParameterList.Name = "HOSTING_NR" and
TransactionParameterList.OPERATION = "1234"
It's possible?
How?
I'm using AWS .NET SDK
Regards!
"TransactionID": "657",
"TransactionInstanceIdentifier": "919C5A0E-8786-4B86-87BF-5080E2639406",
"TransactionParameterList": [
{
"Name": "HOSTING_NR",
"Value": "1234"
},
{
"Name": "OPERATION",
"Value": "GetData"
}
],
"TransactionStepID": "1491",
"TransactionStepInstanceIdentifier": "0B0763AB-A847-479D-8EFE-43B842F2B2EB"
}
As of now DynamoDB does not support querying list of map items.
workaround in discussion forum here
Whenever I try to query for the length of a film I get lists of null. The query I use is directly from the "Build query" button on their site and looks like this:
[{
"id": null,
"name": null,
"type": "/film/film",
"/film/film/runtime": []
}]
Ufortunately all the responses I get look like this:
{
"name": "4D Man",
"type": "/film/film",
"/film/film/runtime": [
null
],
"id": "/en/4d_man"
}
I can hover over the links you can see on the query page and see the runtime (in this case 85 minutes) but as you can see all I get from the query is null. This may be a Freebase bug, but any help is appreciated. Thank you.
There's not a single runtime of a film, the same film can have different runtimes (original version, director's cut, etc...) Freebase use the film_cut type to contain the different runtimes of a movie
You can use this query to get the runtimes:
[{
"id": null,
"name": null,
"/film/film/runtime": [{
"runtime": null
}]
}]
Tune this query to your needs, you may need type_of_film_cut or film_release_region.
could you please give me a hint on how to share a single event via google calendar api?
That is I'd like to invite other users to see the event programmatically without sharing the whole calendar. To mimic the "Add guests" UI action
As Claudio mentioned, you need to use the Google Calendar Advanced API for this.
You'll want to use a patch because you don't want to replace all the other data on the calendar invite. However, even in the case of patch, since the attendees lives in an array, if you attempt to pass a patch such as this:
{
attendees: [ { email: "new#example.com"} ]
}
... it'll replace all old invitees (i.e. it'll remove anyone that was on the invite before you called patch). To fix this, you must first get the current invitees, add a new person to the array, and then send a patch.
You can see a detailed example of this in this answer which also explains how to use Google Apps Scripting to ensure an email is sent to the user when adding them to a calendar event (see the addGuestAndSendEmail() method in that post).
You can use the API to add people to the attendees collection:
https://developers.google.com/google-apps/calendar/v3/reference/events/update
refer the following request.
method: POST
endpoint: https://www.googleapis.com/calendar/v3/calendars/primary/events?sendUpdates=all
here, sendUpdates means when you add any guest so he would get an invitation mail used based on scenario.
Input Json:
{
"kind": "calendar#event",
"etag": "etag",
"status": "confirmed",
"summary": "JayKara",
"description": "eqwbdjhwhhwhhwrhjehrhejhfj",
"location": "America",
"creator": {
"email": "#mail.com",
"self": true
},
"organizer": {
"email": "#mail.com",
"self": true
},
"start": {
"date": "2019-12-23"
},
"end": {
"date": "2019-12-24"
},
"originalStartTime": {
"date": "2019-12-24"
},
"visibility": "public",
"attendees": [
{
"email": "****#mail.com" //this guys are the guest
}
]
}.
After that there is no patch method required your guest guys will receive an invitation whenever update event
Cheers!