My favorite feature from the recent WooCommerce 2.1 release is the REST API. I may be a bit biased, since it was my core contribution during the 2.1 release cycle, but it lays important groundwork. A platform like WooCommerce is strongest when shop data can be pushed or pulled from other systems, like a mobile app (spoiler: a WooCommerce iPhone app is coming soon!) or a complex integration with a backend accounting system.

In this series we’ll dive into each aspect of the WooCommerce REST API, starting with a general overview of the API, followed by a post on each type of resource that’s available. Before we begin, remember that the REST API is only available in version 2.1 or greater, so if you’re on an older version you’ll need to upgrade first. Let’s get started!

Overview

The REST API is read-only, with the exception of a single endpoint for updating order status. Data is available in either JSON (default) or XML format. There are 5 primary resources, each with a related set of endpoints:

  • Coupons
  • Customers
  • Orders
  • Products
  • Reports

The API can be accessed at https://www.example.com/wc-api/v1 — note the v1 version which takes a first-order position in every endpoint URL. This will only change for major releases and backwards compatibility is planned for at least one major version back, so you can safely build integrations against the version without worrying about a newer version of WooCommerce breaking your code πŸ™‚

You can access the API over HTTP or HTTPS. I strongly recommend using HTTPS wherever possible, as it makes authentication significantly easier. The API Index (discussed below) will indicate if the site support SSL or not.

Responses

The default response format is JSON, which can be changed to XML by setting the HTTP ACCEPT header to application/xml. A successful request will return a 200 OK HTTP status, while unsuccessful responses will return non-200 statuses — a detailed listing of errors is available in the REST API documentation.

Authentication

There are two ways to authenticate with the API, the easy way (over HTTPS) or the hard way (over plain HTTP using OAuth). If you’re developing an integration designed to work with any WooCommerce store, you’ll need to support authentication schemes, as you can’t guarantee that every store will have SSL enabled. The API Index endpoint will indicate if the site supports SSL.

With that in mind, login into your WP-Admin and go to your user profile to generate your API keys. You should see something like this:

woocommerce-rest-api-keys

Keys inherit the permissions of the user that generates them, so if you’d like to have more granular control over the permissions you can create a new user specifically for the API.

Over HTTPS

Simply use HTTP Basic Auth by providing the API Consumer Key as the username and the API Consumer Secret as the password:

$ curl https://www.example.com/wc-api/v1/orders -u consumer_key:consumer_secret

If you’re manually setting the HTTP Authorization header, remember that you must Base64 encode the keys first, like so:

php > $authorization = base64_encode( $consumer_key . ':' . $consumer_secret );

Over HTTP with OAuth

HTTP Basic authentication cannot be used over plain HTTP as the keys are susceptible to interception. The API uses OAuth 1.0a “one-legged” authentication to ensure your API keys cannot be intercepted. This process involves generating a signature and including it with your request. The API then generates it’s own signature and compares it against the one provided. If they match, the request is authenticated.

The process for generating this signature is not difficult, but it must be followed exactly. The best way is to use an existing library in your language of choice to handle OAuth authentication. If you’re a glutton for punishment and want to generate the signature manually, have a look at RFC 5849 which describes how to generate the signature.

Parameters

Most API endpoints accept optional parameters passed as HTTP query string parameters, e.g. GET /orders?status=completed — but the most important parameter is the filter parameter. This parameter is used for date filtering, searching, and pagination. See the full list, along with examples, in the REST API documentation.

API Index

The API index provides information about the store, as well as a listing of available endpoints. No authentication is required to access the index. The most important property is ssl_enabled which will indicate if SSL is available or not. A sample response is available in the docs.

Additional Reading

Next in the series we’ll detail how to get order information, along with how to update the status of an order. Until then, here’s some additional reading about the API:

Published by Max Rice

Max is one of our co-founders, CEO, resident webhook expert, and coffeescript lover. He's a top WooCommerce contributor, unit test aficionado, survivor of coding with timezones, and spends much of his time being the chief bottleneck at SkyVerge.

120 Comments

  1. […] Max Rice is writing a series of articles on using the WooCommerce REST API and posted an introduction to the WooCommerce REST API this […]

  2. Great intro. Thanks Max!

  3. Max,
    This is awesome. Just read through the docs and wrapper as well. Those will be a good head start. Question, can you share a link where I can find all the parameters of the woo objects?

    For example, if I use get_order( $order_id ) that will return the entire order in an object. Is ther a place that lists the names of elements of all the possible objects delivered in the API, or do I jut need to call them all and print them out to see? Like if I just want to work with price, or sale price of that order Id.

    Thanks.

    Craig

  4. i want to get and update product stock details using woocommerce rest api in c# desktop applications….any idea about this…
    thanks in advance….

  5. Hey, I tried this last night and it just worked perfectly.

    Connected over the API and updated the order status from on-hold to processing.

    Thanks for the great functionality, documentation and sample code.

    Jay

  6. I have a localhost setup with a vanilla MAMP, WordPress and WooCommerce installment. I have enabled HTTPS and the site works like expected on SSL.
    But when I curl the endpoints of the wc-api, all I get is a standard 404:

    curl https://localhost/wordpress/wc-api/v1/orders/count -k -u ck_1a2d4e2c6483d8456c74d7a98e02456d:cs_9f93cead27ecfd35ddab7155b1746bed

    This results in:

    404 Not Found

    Not Found
    The requested URL /wordpress/wc-api/v1/orders/count was not found on this server.

    The REST API is enabled in the wooCommerce plugin as required. It’s like the Apache server just don’t recognize the API endpoints.

    Any suggestions would be extremely appreciated.

  7. Hello Max,

    Thank you very much for the information shared in your blog.

    We are building an App using the Jquery Mobile + JSON API to get some of the Woocommerce elements in place. So far we have been able to pull categories, products, and adding products to the cart as well as remove them. But we are hitting a wall now because we cannot find information about the methods used to generate the checkout page and all the forms that involve a transaction.

    Could you please provide some guidelines or point some documentation for us to be able to move ahead with this task?

    Thank you very much in advance,

    Cesar

  8. Thanks @Max for this, the API looks really good.

    I’ve just been tinkering around with it for an hour or so, and was wondering if a Customer level user can make API calls.

    Store Manager is working fine, but how about a Customer – for example to simply call:

    GET /products

    So customers can see a list of available products, like a catalog.

    Keep up the top work!
    Cheers
    Ismail / ATutorme

  9. Hi,
    I am using the woocommerce API.
    Everything went alright but when i call the endpoint products it returns just the first 10 products.
    Is there some pagination? Could you help me?

    Thanks!

  10. Is there anyway to get the product data after it has gone through all the filters and another thing the woocommerce iphone app you’re developing .. how do woocommerce extensions fit into that??

    • Which filters? The product data is already run through the standard WC filters. The WooCommerce iPhone app will eventually support various extensions, but we don’t have a good sense of what that looks like exactly yet πŸ™‚

  11. I’ve been trying to get the API to work with oauth as my shop doesn’t have a ssl certificate.
    But I haven’t found any (C#) oauth library which uses the params in the query string.
    Could someone please point me in the right direction?

  12. Hi Max,

    Will the be an endpoint which lets us get the order statusses in the REST API V2?

    Giancarlo

  13. Hi Max,

    I observed in both API Version 1 and 2 that the “get all customers” function, only give you the first 4 users from the “customer” group.

    I didn’t found documentation (or didn’t used the right keywords to search on) about this.
    How can I retrieve all customers and or how to retrieve all users?

    • The default limit is 10 customers, so if you’re only seeing 4, it’s possible that there’s an error happening server-side. I’d check the PHP error logs and see if there’s anything. If you want to retrieve *all* customers, you can use the `filter[limit]` query argument, like `GET /customers?filter[limit]=500`.

      • Hi Max,

        I alway get 4 customers.
        If I set one of them to another customer group, than that user isn’t listed anymore, but 1 new customer is added to the result of 4.

        • Hard to troubleshoot this via a comment, but it sounds like the default pagination in your case is 5 somehow — I’d try adding `?filter[limit]=100` to your query and see if that changes how many are returned πŸ™‚

  14. Hi Max,

    V2 is dropping XML response format in favor of JSON. My product provider requires XML.

    1. How long will V1 be available?
    2. Is there a workaround if I need to have my response format in XML?

    Thanks.

    • v1 will be around for another 6 months, possibly longer. When it’s slated for removal, it’s likely that we’ll extract the XML response part of it into a plugin on wordpress.org so it can still be used. It is be possible to add an XML response type to the v2 API if you really need it πŸ™‚

      • Hi Max,

        I need some development support with the API. Is Skyverge able to assist me or if not can you refer me to some other developers? Thanks in advance.

        Tim

  15. Hello Max
    Is there a simple complete example of how do i use de new REST API (v2) for change product data?
    I need to update stock_quantity and I donΒ΄t understand how to do it. Also in simple products or product with variations.

    Thank you..
    Willy

    • We’re working on new tutorials for the v2 REST API, stay tuned πŸ™‚ In the meantime, if you do GET /products/#{id} and change the stock quantity on the returned data, then do PUT /products/#{id} with the JSON as the request body, it should work.

      • Thanks Max.
        IΒ΄ll try..

        Willy

        • Thanks Max!!!
          Works like a charm πŸ™‚

        • Mmmm.. very sorry.
          It was an illusion… πŸ™
          I came back and modify class-wc-api-products.php
          adding at top of edit_product method a few lines.
          I only need for now to change stock_quantity, in this way with a few parameters I have all..
          Too bad I’ll have to modify it when updates cames from woocommerce..

          /**
          * Only to change stock_quantity in simple product or variation product
          * …rest api…/products/{id}
          * parameters json of array(“product”=>array(“stock_quantity”=>QUANTITY))
          */
          if (isset($data[“stock_quantity”])){
          wc_update_product_stock( $id, intval( $data[‘stock_quantity’]) );
          return $this->get_product( $id );
          }

        • Hi Max,

          I’ve been trying to upload with the API V2, but it just won’t work.

          I always get an error:

          The remote server returned an error: (401) Unauthorized.
          Status ProtocolError System.Net.WebExceptionStatus
          [0] “Vary” object {string}
          [1] “Content-Length” object {string}
          [2] “Cache-Control” object {string}
          [3] “Content-Type” object {string}
          [4] “Date” object {string}
          [5] “Expires” object {string}
          [6] “Set-Cookie” object {string}
          [7] “Server” object {string}
          [8] “X-Powered-By” object {string}

          Downloading data from the store works, but adding/changing data back to WC just fails.

      • Hi Max,

        Although it could obviously be something that simple, I had thought about that myself.
        I just never could have got it to work.

      • Hi Max,

        This method worked for me too.
        I used GET to get the JSON of the current product, then I converted it to array with json_decode and updated the stock_quantity and then PUT the JSON (decode) back and it is updating the stock quantity perfectly.

        However, when I want to change the stock_quantity of a variant, I am doing the same thing, but the result I get when PUTting is:

        {“errors”:[{“code”:”woocommerce_api_product_sku_already_exists”,”message”:”The SKU already exists on another product”}]}

        Any idea why or what I can do to fix?

  16. Hey, does anyone know how I can bypass using the default method that woocommerce uses to post to paypal on the checkout page in exchange for using my own form that post hidden input fields to paypal?

    ~Alex

  17. Hey Max,
    I am trying to get product count for a store using WooCommerce REST API Client Library, but I am get this kind of error
    stdClass Object ( [errors] => Array ( [0] => stdClass Object ( [code] => woocommerce_api_authentication_error [message] => Invalid timestamp ) ) )

    Can you tell me what might the problem be?

  18. Hey Max, great work.
    I ve a question:
    I installed last wordpress release with last WooCommerce release (www dot elasticoweb dot com) at my web farm, configured pretty permalinks and rest api was enabled, but URL ‘http://www dot elasticoweb dot com/wc.api/v2’ give me a ‘Not found’ page.
    On local development environment all works well.
    On web farm WooCommerce System Status says ‘Your server does not have the SOAP Client class enabled – some gateway plugins which use SOAP may not work as expected.’
    This is the cause?

    Thanks

    • Try /wc-api/v2 instead πŸ™‚

      • Ty for answer, I’m sorry, i wrote ‘wc.api’ instead ‘wc-api’ in the post, however i solved: my web farm installation had no permission to create .htaccess file :-).

        Now the other big issue: i can’t have the right oauth signature, at both local and web farm.
        I used a .NET Oauth library (https://github.com/danielcrenna/oauth), that seems to work well, i compared its result with many web oauth test, and i got the same signature. But this signature is different from wordpress rest api signature. Why?
        I printed query parameters at wordpress side and seems to be the same those i send.
        Seems ‘base64_encode( hash_hmac( $hash_algorithm, $string_to_sign, $user->woocommerce_api_consumer_secret, true ) );’ statement calculate a different signature.
        Anyone can help me?

        • Yeah unfortunately a lot of libraries for OAuth make the mistake of assuming the token is required, whereas the spec says it’s not. This break the signature when you don’t provide a token. I’d look at the library you’re using and see if it’s including that, and if you can patch it, that’s great. Otherwise you’ll have to copy in their code and make the change directly.

  19. Hi,

    I’m using HTTPS to connect my Application, It works last month. But unfortunately It is not working now. I’m getting an error,
    {“errors”:[{“code”:”woocommerce_api_authentication_error”,”message”:”Consumer Key is invalid”}]}

    And I try to regenerate my WooCommerce API Keys, But same error again. this is my URL

    https://ishoppers.com.sg/wc-api/v2/products?consumer_key=ck_1145bf****&consumer_secret=cs_11da6d*****

    Can you please advice me what is the issue. Thanks.

    • You’ll have to triple-check that your keys are correct because you don’t get this error unless it can’t validate them πŸ™‚ If you’re sure, then you edit the plugin source to echo what key the API is seeing to make sure it’s not being corrupted somehow by your server.

    • Hi,
      can you or anyone advise a .NET library compatible with WordPress API rest?

    • Omg. I did not find a good .NET library. Why?
      Luckily i read this http://oauth.googlecode.com/svn/code/vbnet/oAuth.vb .
      There are some errors:
      WRONG -> hmacsha1.Key = Encoding.ASCII.GetBytes(String.Format(“{0}”, UrlEncode(consumerSecret), IIf(String.IsNullOrEmpty(tokenSecret), “”, UrlEncode(tokenSecret))))
      RIGHT -> hmacsha1.Key = Encoding.ASCII.GetBytes(consumerSecret)
      and
      WRONG (order) ->
      parameters.Add(New QueryParameter(OAuthVersionKey, OAuthVersion))
      parameters.Add(New QueryParameter(OAuthNonceKey, nonce))
      parameters.Add(New QueryParameter(OAuthTimestampKey, timeStamp))
      parameters.Add(New QueryParameter(OAuthSignatureMethodKey, signatureType))
      parameters.Add(New QueryParameter(OAuthConsumerKeyKey, consumerKey))
      RIGHT ->
      parameters.Add(New QueryParameter(OAuthConsumerKeyKey, consumerKey))
      parameters.Add(New QueryParameter(OAuthNonceKey, nonce))
      parameters.Add(New QueryParameter(OAuthSignatureMethodKey, signatureType))
      parameters.Add(New QueryParameter(OAuthTimestampKey, timeStamp))
      parameters.Add(New QueryParameter(OAuthVersionKey, OAuthVersion))
      and
      WRONG -> normalizedUrl += “:” + url.Port
      WRONG -> normalizedUrl &= “:” & url.Port

      so you can use this class successfully in this way:

      Dim URI As Uri = New Uri(“http://www.myhost.com”)
      Dim ConsumerKey As String = “*****************************”
      Dim ConsumerSecret As String = “***************************”
      Dim HttpMethod As String = “GET”
      Dim SignatureMethod As String = OAuth.OAuthBase.SignatureTypes.HMACSHA1

      Dim OAuthBase As OAuth.OAuthBase = New OAuth.OAuthBase

      Dim TimeStamp As String = OAuthBase.GenerateTimeStamp
      Dim Nonce As String = OAuthBase.GenerateNonce

      Dim Signature As String = OAuthBase.GenerateSignature(URI, ConsumerKey, ConsumerSecret, “”, “”, HttpMethod, TimeStamp, Nonce, SignatureMethod, “”, “”)

      Dim RequestUrl As String = String.Format(“{0}?oauth_consumer_key={1}&oauth_timestamp={2}&oauth_nonce={3}&oauth_signature={4}&oauth_signature_method={5}&oauth_version={6}”, URI, ConsumerKey, TimeStamp, Nonce, HttpUtility.UrlEncode(Signature), “HMAC-SHA1”, “1.0”)

      Dim request As HttpWebRequest = CType(WebRequest.Create(RequestUrl), HttpWebRequest)

      Enjoy πŸ™‚

  20. Hi there,

    Cool stuff! I was looking for using the REST API to power a mobile app for my bargain hunting website. But my app developer run into issues with the authentification. I have to admit that I am pretty much non-technical (which is why I like WordPress so much).

    Is there any way to make the API work without any notification?

    The background is that we do not have our own inventory but send the user to wherever the best deal is ( a bit like price comparison websites). Therefore all our products are of the external type and we store 0 customer data. Actually I just want to display products in the app. So a SSL certificate etc. would feel like overkill.

    Any ideas?

    Cheers,
    David

    • If this is just your own site you need to display products from, your developer should be able to make the products endpoint public so that it doesn’t require any authentication. He’ll likely also want to remove the total_sales property from the data as well. Hope this helps πŸ™‚

    • Hi Did u solved?

  21. I just installed the latest woocommerce plugin and php client library. Everything works fine except view list orders.

    I want to view the orders list with status => pending. It works fine if there are orders with status as pending. But the API returns all orders if there are no orders with pending status.

    I am not sure why it is displaying all orders instead of showing message like no order found.

  22. How can run woocommerce rest api without https:// on http:// with oauth, please help me it
    i have google about it, but nothing find.

    • This is possible to do with custom code on the WooCommerce side, but I strongly recommend not changing any of the authentication — you may inadvertently create a security issue πŸ™‚

  23. Hello, nice content, but the Additional Links are not working. πŸ™

    Regards

  24. I have SSL and accessing the API with HTTPS. I am getting authentication errors. I get a good response when requesting the API Index as it needs no authentication. Everything else gives me this error:

    {“errors”:[{“code”:”woocommerce_api_authentication_error”,”message”:”\u30b3\u30f3\u30b7\u30e5\u30fc\u30de\u30fc\u30ad\u30fc\u304c\u3042\u308a\u307e\u305b\u3093″}]}

    • Looks like your server is removing the Basic-Auth header (the error message is コンシγƒ₯γƒΌγƒžγƒΌγ‚­γƒΌγŒγ‚γ‚ŠγΎγ›γ‚“ which translates to “missing consumer key”) — try adding the consumer key/secret as query parameters (e.g. ?consumer_key=ck_abc123&consumer_secret=cs_abc123)

      • Max, not sure how I would actually add this format. I was testing the API with OSX terminal.

        Also, when creating a product via API a link is provided for the gallery images. Are these going to be transferred to the wordpress host or will they be hotlinked from the existing URL?

        • Got this working. It was too easy.

          • Hi Sir, I actually have the same question and problem. I have a server that hosts all my images. I don’t want WordPress to handle them. So when I created or updated a product, I sent the API the image URLs from my server, unfortunately, the API automatically creates a copies to the WordPress uploads folder and the references will all be directed to there. Is there any way I can disable this and just use my own image server? Thank you so much.

          • This is a problem with WordPress in general. Hotlinks are not really supported unless done very manually from what I have found. There is a plugin that allows for image hotlinks in WordPress and works with WooCommerce galleries, but it does not work when using the API. This should be a native feature in WooCommerce.

            We live in an age of CDNs that serve images faster when they are on a different domain or subdomain.

            You can change your directory from wp-content to something else but not really what either of us are looking for. This feature would allow for much easier image control and would reduce storage needs for multisie/multilingual WooCommerce stores. WordPress native image management is a huge pain.

            I suggest you let WP know you want this feature to be supported better. Woo is just working with what they have, but they could make it happen.

      • Max, Is there an easy way to get the Japanese text from the encoded characters?

      • Max, I can get the authentication to work using the keys as a query in the browser. I can GET any information this way, but I still cannot get authentication work any other way so I can PUT and POST.

  25. HI ,

    I want to access WooCoommerce REST API, when i want to access products form this http://sws.thebluebell.in/wc-api/v2/product url, it shows {“errors”:[{“code”:”woocommerce_api_authentication_error”,”message”:”oauth_consumer_key parameter is missing”}]}

    ERROR.

    Please give me help.

  26. I am still having authentication issues. It is just not cool.

    • Which errors are you seeing?

      • {“errors”:[{“code”:”woocommerce_api_authentication_error”,”message”:”\u30b3\u30f3\u30b7\u30e5\u30fc\u30de\u30fc\u30b7\u30fc\u30af\u30ec\u30c3\u30c8\u304c\u3042\u308a\u307e\u305b\u3093″}]}

        Pretty much the same error.

        This occurs when using the keys as -u or as a query string in the URL for any type of Get Put or Post command from the terminal command line. For example trying to simply update order status. I also get some 404 errors saying the post does not exist when a very specific post ID is specified and it does exist.

        Get functions work when the keys are used as a query in a browser URL. Put or Post never works with the URL.

        • That translates to “Missing consumer key” which is generally a server-config issue, though if you also see that when passing the consumer secret as a query string param, I’m not sure what would cause that.

          Do you have any security plugins installed (iThemes security, etc) or mod_security installed on the hosting side? They could also be the cause of the issue here.

          • No crazy security stuff. I am trying to set this up a better way.

            I need to access the API via URL and I cannot figure out how to pass the post id into the API via URL.

            I am also trying to figure out how to decode the response back to Japansese.

  27. Hi there.

    Great post! And still good response on comments, so I think I will have a go at asking a question here that I haven’t been able to find the answer for.

    I am settin up a site, using the API to add products to WooCommerce. The products are live, I can see it if I use a shortcode for showin on-sale products and other criteria based showings. BUT, unless I manually go into the admin and update each and every product manually, the products does not show in the product categories or on the shop page. I am totally puzzled as I thought it would be related to the product not being live – but as it turns out, I can even add and purchase a product, if I set up a page using one of the mentioned shortcodes.

    Have you ever heard about this or have any thoughts of what this could be related to?

    All the best

    • Sounds like a caching issue — try disabling any caching plugins you have and talk to your hosting provider about disabling any server-side caching to see if that’s the issue πŸ™‚

  28. I have this working now and I was able to update an order status as a test. One troublesome part of all of this is retrieving the post_id of the order when you are using sequential order numbers. The only way to get it is to parse though all the order in a list until you get a match.

    Having the order section of the API that will return the post_id when an order_number_formatted is supplied would be very useful.

    The same would be nice for _sku and post_id. When you think of how people might be using the API for updating and interacting with other services that do not know the post_id.

    • How can I get Carriage Returns into the description and short description fields?

      • I have tried a bunch of things to get this working.

        text1\ntext2

        text1\\ntext2

        text1\r\ntext2

        None of these work.

        When I GET the JSON reply from the API after creating a product manually in wordpress with multiple lines it shows

        <p>text1<\/p>\n<p>text2<\/p>

        I cannot seem to reproduce this when creating a post with the API.
        When trying to replicate this exactly I end up with

        <p>text1 text2<\/p>\n

        Which is not the desired result at all. I am only getting single line entries.

        • “enable_html_description”: true,
          “enable_html_short_description”: true

          These values were added to the API docs.

    • The orders response includes two attributes, order ID and order number. The ID is the WP post ID, and the order number is generated by sequential order numbers.

      I believe the products response is the same in returning both the product ID (WP post ID) and SKU.

      • Max, Thanks for the reply. I am really referring to adding the API to an existing Woo store that has thousands of products and orders. I suppose the ID is just an SQL query away. Mostly I am looking at this from a multi-chanel integration view.

        For example if you are starting only with the SKU or Order Number and need to get the needed post ID to use the API.

        • Ah yeah I see what you mean — I believe a product lookup via SKU endpoint is being added in 2.4, might be worth adding an issue for the same thing for order numbers. I agree that it’s a very reasonable use case to only have the order number in some external system and need to look up the actual order via it πŸ™‚

  29. Hi max,

    It’s a great tutorial, i am trying to sync two shopping carts one is on Woo Commerce and another one is custom cart. So when user wants to buy products on custom cart, i like to show the product which were added to cart in woo commerce and vice versa.

    In Simple is it possible to access items in woo commerce cart using woo commerce rest api.

  30. I have been trying to use the following options without any luck. The API keeps clearing out all the HTML tags.

    β€œenable_html_description”: true,
    β€œenable_html_short_description”: true

    Specifically I have tried
    “short_description”: “text1\ntext2″,”enable_html_short_description”: true
    “short_description”: “text1text2″,”enable_html_short_description”: true
    “short_description”: “text1<\/p>\n

    text2<\/p>”,”enable_html_short_description”: true
    “short_description”: ”

    text1

    \n

    text2

    “,”enable_html_short_description”: true
    “short_description”: ”

    text1<\/p>

    text2<\/p>”,”enable_html_short_description”: true
    “short_description”: ”

    text1<\/p>\n

    text2<\/p>”,”enable_html_short_description”: true
    “short_description”: ”

    text1

    text2

    “,”enable_html_short_description”: true

    Maybe a few others, but you get the idea. Nothing really worked.

    All are returning single line text:
    “short_description”: ”

    text1 text2<\/p>\n”

    Do you have any advice on how this should work? This seems to be my last issue with getting this API working perfectly.

  31. Question for Max Rice. Woocommerce[WC_API]. What hook can i use after callback?
    After callback i need to run some requests to server, and i don`t know what hook i need to run? Please tell me, which hook can i use after callback was finished and response was send?

    add_action('woocommerce_api_my_gateway', array($this, 'check_callback_response'),10);
    function check_callback_response()
        {
            if ( ! empty( $_POST )  ) 
            { 
                header( 'HTTP/1.1 200 OK' );
                do_action( "valid-callback-request", $_POST );
    
    } else {
        wp_die( "Failure" );
    
    }
    exit();
        }

    i need to run after exit();

    function Next_function_after_api_callback(){}

  32. Hi Max
    Great Intro very nice also i have used woocommerce API but it gets error in String token unauthorized of third party interaction of order which taken.

  33. Very interesting post on the Woocomerce REST API πŸ˜‰

  34. Hello, I want to use “WooCommerce REST API Client Library” for using WooCommerce REST API over http://. I have gone through the following github link of the library–> https://github.com/kloon/WooCommerce-REST-API-Client-Library

    There i couldn’t understand the setup procedure for this library. Can you please help me setup the simple library into wordpress.

    As usual i am only able to get the index of the site by using –>> http://localhost/wordpress_new/wc-api/v1/
    where its not possible to perform any other operation.

  35. can you please tell me how to connect Woocommerce Rest Apies to android app

    or how to get product list in json format using REST apies

  36. does this api supports customer-side?
    I mean ….can we use this api to order products? can we add tocart? can we checkout?

    Thanks in advance!

    • Hopefully this comes in the future. It would put WC in the ballpark as a powerful ecommerce framework that would be independent of themes and would allow for nice mobile ecommerce shopping apps.

  37. Hi all, hoping Max Rice may be able to point me in the right direction to resolve whats occurring for us. We have a local dev setup, with self signed SSL, trying to get a Webhook to push completed orders to a remote server.
    I’ve setup test hooks for ‘action.woocommerce_add_to_cart’ and ‘order.created’ & also setup numerous webhook loggers to try and determine the cause of no data (other then the id registration, eg. http://webhookinbox.com/view/kJwHYgZA/ ) and nothing appears in the webhook logs at all.
    Any help or direction to explore would be hugely appreciated – I’m clutching at straws trying to determine why it would post the id registration, but not operate on any of the hooks.
    Big thanks in advance!

  38. Getting empty arrays from the API, any ideas? {“products”:[]}

  39. FWIW I am still not getting HTML descriptions to work with the API and the Git group has not responded since they said this was fixed, even though I let them know it is still not working for me.

    Can you confirm this works or maybe look into it.

  40. Hi,

    I may be the only non developper on this page.

    I create basic woocommerce sites for clients, when basic mean no interraction with any external tool.

    However, I need to do stuff like this for a client. I’ll hire someone to do it, but just to be sure :

    Is that REST API what I need to pull data from an existing CRM (customers, products, prices, specific price conditions per customer group etc.) and populate the website with that data ?

    If so, what do I need from the existing software for all that stuff to work ? I mean, is there a need for some kind of API from the existing software ?

    Thanks for your help.

    BTW, I won’t implement these myself, but I’d like to know what’s implied here, so that I can talk with the dev more efficiently.

  41. Hi, First of all your blog is outstanding πŸ™‚
    I have a question Pleaseee Help me in this problem. I want to add a product in cart using woocommerce rest api but the Woocommerce rest api says it is only for read data. So please tell me how can i achieve this ?

  42. http://woothemes.github.io/woocommerce-rest-api-docs/?shell#update-a-customer

    Hi.

    I wants to implement this method on Android. I am getting the error every time..
    { “errors”: [
    {
    “code”: “woocommerce_api_authentication_error”,
    “message”: “Consumer Secret is invalid”
    }
    ]
    }

    I have tested the same method over postman REST CLIENT too but there its asking again and again for username and password.

    If i am setting the user name as consumer key and password as consumer secrete. still the pop up coming again and again.. If I am pressing the cancel button than the error is same..

    “errors”: [
    {
    “code”: “woocommerce_api_authentication_error”,
    “message”: “Consumer Secret is invalid”
    }
    ]

  43. Hi there,

    I’m trying to get a full list of my products via the REST API but I get only the first page of 133 pages as show by the following http headers in the response:

    X-WC-Total β†’ 2386
    X-WC-TotalPages β†’ 133

    Using node.js, I tried appending filter[limit]=-1 and page=2 to the url but it seemed to have no impact at all. Am I missing something?

    Thanks

Hmm, looks like this article is quite old! Its content may be outdated, so comments are now closed.