I'm using the WooCommerce REST API to download Orders into our internal CRM database. We're currently doing this by requesting all Orders between 2 date ranges, e.g.
wp-json/wc/v2/orders?after=2018-05-08T00:00:00Z&before=2018-05-14T23:59:59Z&page=1&orderby=id&order=asc
and this is working well. We were wondering if it's possible to change this to just request all new orders since the last Order ID that we downloaded. For example if the last Order ID we downloaded was 2450 we would like to make a request to get all new Orders after 2450. I've been reading the docs for the parameters to list all Orders but not sure if this is actually possible?
At the time of writing this is not currently possible. Hopefully a future update to the API will allow this.
Related
I'm currently working on a WooCommere site which I need to update orders on via an API.
I'm a total novice when it comes to working with API's. I have created a webhook that fires when an order is created, this works fine.
I can also update the JSON to change meta such as the customer name and
POST the data back and I can see it updated in the back end when using the following url
https://xxxxx/wp-json/wc/v3/orders/5858
My question is how do I associate the response to an order? For example, if I send over 20 orders to the api how can I send them back to my site and get the orders updated?
eg order ID 001,002,003 etc
Do I use the following url:
https://xxxxx/wp-json/wc/v3/orders/
If I append the url with the order ID the single 001 order updates no problem
https://xxxxx/wp-json/wc/v3/orders/001
I've read a couple of tutorials but they all seem to work by updating 1 order. I don't understand how to do this with multiple orders surely I don't need to manually create the URL for each order so the API can update them?
I'm totally lost and feel like I'm missing something totally basic.
Any pointers would be very much appreciated.
I'm using the woocommerce library for nodejs to fetch product data.
The app already has all the product and variation ids, I just need to periodically fetch prices for the variations. I know I can use include: [ids...] to fetch multiple products at once, but it doesn't work when fetching variations. I also know I can fetch all variations of a single product, but with the number of products to fetch this generates too many requests.
Is there a better way to get multiple variations, or just their prices, within one API request?
Thank you
I'm sorry but there is no way to get all variations in one request.
You need to do a request for each variable product to get all variations that belong to that product.
To avoid too many requests you can add some sort of delay between each request so you don't get ratelimited if that's the problem.
I'm working on a simple app to programmatically retrieve ads performance within Linkedin. I have general API experience but this is the first time i get my feet wet with the Linkedin API.
One example from Linkedin API documentation suggest something that would get me started:
GET https://api.linkedin.com/v2/adAnalyticsV2?q=analytics&dateRange.start.month=1&dateRange.start.day=1&dateRange.start.year=2016&timeGranularity=MONTHLY&pivot=CREATIVE&campaigns=urn:li:sponsoredCampaign:112466001
I am encountering two problems:
First this example implies that you already know the campaign ID. However I am unable to find a way to retrieve a list of campaign ID's for a given account.
Second, if I manually pull a campaign ID, I receive an error: "{"serviceErrorCode":2,"message":"Too many fields requested. Maximum possible fields to request: 20","status":400}". Pretty clear error.
A little research tells me that by adding the parameter "&fields=" I will be able to limit my query to less than 20 field (I really need only a dozen anyway) but I can't find and documentation regarding the names of the fields available.
Any help or pointer will be appreciated.
please refer the link below scroll down where you ill see the field names mentioned as metrics , these are the fields.
https://learn.microsoft.com/en-us/linkedin/marketing/integrations/ads-reporting/ads-reporting?tabs=http#analytics-finder
I have tried to retrieve all the products of a Woocommerce shop using this kind of request, but I only get 10 products:
http://www.mystore.com/wc-api/v3/products?oauth_consumer_key=ck_1234&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1488898708&oauth_nonce=a83kF3&oauth_signature=whatever
The only solution I found is to add a filter in the request in order to get a specific number of products, ex: &filter[limit]=1000. This works fine but the problem is that I need a generic solution because now I want to get products from multiple stores and some of them can have thousands of products.
Is there a better way to get all the products of a store without setting the limit?
OK, it seems that -1 is doing the job: &filter[limit]=-1 or filter%5Blimit%5D=-1
I will add a hint in case someone ends up in the same situation...
if you need to make an API call using Java, make sure you encrypt the above filter together with the rest authorization parameters so as to get the oauth signature.
Here is the setup.
Customer fills out form of information for product specifications. This creates an entry in the db with a unique detailsID.
They then are taken to a product page, with many variables. They select the variable product and checkout.
Now in the db they have an order as well as a separate table with the details of their request.
What is the best way to connect the product they bought with the detailsID?
I would like to basically pass the detailsID to the product page, then add this detailsID to the product. Or add the orderID back into the details table.
I keep going around whether to add this as meta data, or use a session, or just do post order logic to add the order ID back into the details table.
I really just need to link the two once the order completes but am not sure the best method to do this. I am pretty new to Woocommerce so don't know a lot of the hooks yet.
Thank you so much for your suggestions!
After a lot of research and experimenting here is the method I have decided on. This seems to add the information in a variety of places to make it easy to track orders and to insure that the customer is getting the customized product they want.
add custom data to woocommerce
I am using this method very close to how it is spelled out in this great article. This was really helpful for me being a woocommerce newb.