Explainer

Connect your supplier's API to WooCommerce, without code

Your supplier gave you an API link and a key, and you want their products in your shop. Here is what those words mean, what to ask for, and how to get the products in and keep them up to date.

1 What a supplier API is

An API is an address on your supplier's server that answers with data instead of a web page. You (or a plugin) send a request to that address, and it replies with the product list: names, prices, stock, pictures and so on.

Because the answer always has the same structure, a program can read it and turn every item into a WooCommerce product, and do it again tomorrow to pick up new prices.

2 Three ways to get the products into WooCommerce

WayGood forThe catch
Spreadsheet (CSV) importA one-off import of a small catalogue. WooCommerce has a CSV importer: the Import button on the Products screen.Someone has to export, fix and re-upload a file every time prices change.
Custom codeUnusual APIs, or very specific rules.You pay a developer to build it and again whenever the supplier changes something.
An API sync pluginMost suppliers that offer a JSON API.The API has to return products as JSON, which almost all modern supplier APIs do.

The rest of this page is about the third way.

3 What to ask your supplier for

Before you start, get these from your supplier or from their developer documentation:

  1. The product list address, for example https://api.supplier.com/v1/products.
  2. How to authenticate: an API key, a token, a username and password, or nothing.
  3. Where the key goes: in a header (and its name), or in the address.
  4. How pages work, if the catalogue is large: which parameters choose the page and the page size.
  5. Limits: how many requests you may send per minute or per day.

Ask for one example answer as well. Seeing a real product in the API answer makes the field mapping a two-minute job.

4 Keys and tokens, in plain words

Most supplier APIs check who is asking. The common ways, as the plugin names them:

In the pluginWhat your supplier’s docs say
No authenticationNothing, the list is public.
Bearer tokenAuthorization: Bearer YOUR_TOKEN
Token in a custom headerTheir own header name, such as X-API-Key or CJ-Access-Token.
Basic PROA username and password.
Key in the URL PROSomething like ?api_key=YOUR_KEY at the end of the address.
OAuth 2 PROA client ID and secret that you exchange for a token.
HMAC signed PROAn app key and secret used to sign every request (AliExpress and similar).

Treat the key like a password. Never paste it into a public page or a support forum. The plugin stores it encrypted in your own WordPress database and sends it only to the address you entered.

5 What the answer looks like

A supplier API usually answers with JSON. A typical product list looks like this:

{
  "data": [
    {
      "id": 1042,
      "title": "Cotton T-shirt",
      "price": 8.50,
      "stock": 120,
      "category": "T-shirts",
      "images": ["https://cdn.supplier.com/1042-front.jpg"]
    }
  ],
  "total": 3500
}

Two things matter here. The products sit inside data, which is the products root path. And each product has its own field names: this supplier says title, another says name or productNameEn.

6 Matching the fields to WooCommerce

Field mapping tells the importer which supplier field fills which WooCommerce field. For the example above:

WooCommerceSupplier field
Product ID (required)id
Product name (required)title
Regular price (required)price
Stockstock
Categorycategory
Imagesimages

The product ID is the most important one: it is how the importer recognises a product on the next run and updates it instead of creating a copy.

TechCare API Product Sync fills this table for you when you press Test connection & detect fields. You only check it and fix anything it guessed wrong. Fields inside other fields use dots, such as pricing.retail. Products with sizes and colours: see importing variable products.

7 Large catalogues and pages

An API rarely sends 10,000 products in one answer. It sends a page, for example 100 products, and you ask for the next page until there are none left. Suppliers do this in one of two ways:

  • limit / offset: “give me 100, skipping the first 200”, for example ?limit=100&offset=200 (some call it skip or start).
  • page / per_page: “give me page 3, 100 per page”, for example ?page=3&per_page=100 (or pageNum and pageSize).

PRO Pro reads every page for you: choose the Pagination style, and the connection test checks that page 2 really returns different products from page 1. The free edition reads the address once, exactly as you entered it.

8 Doing it step by step

  1. Install TechCare API Product Sync (start with the free 7-day Pro trial: up to 50 products, no card).
  2. In Settings → Source and connection, paste the product list address and choose the authentication your supplier uses.
  3. Press Test connection & detect fields, check the mapping, and save.
  4. In Pricing and profit, switch on Apply pricing rules and enter your markup.
  5. Press Sync now on the Dashboard and watch the products arrive.

The getting started guide walks through each screen, and the CJdropshipping tutorial shows a complete real example.

9 Before you go live

  • Open a few imported products and compare name, price, stock and pictures with the supplier.
  • Check that your markup gives the selling prices you expect.
  • Run Sync now a second time: nothing should be duplicated, and products whose data did not change are skipped.
  • Decide how often to sync. Prices and stock change more often than names and pictures; Pro can run a fast price-and-stock update between full syncs. See keeping prices and stock in sync.

Try it with your supplier's API

Every Pro feature free for 7 days, up to 50 products, no card needed.

Start the free trial

Questions about your API? Email support@techcare2.com with a link to its documentation.