API = Application Programming Interface, zu deutsch Programmier-Schnittstelle.

Wozu sind diese Schnittstellen gut? Um Daten zwischen unterschiedlichen Anwendungen auszutauschen.

Insbesondere in Shopsystemen ist der Austausch von Daten mit anderen Systemen notwendig, z.B. mit der Software der Buchhaltung oder des Warenlagers.

Unabhängig davon ist ein API auch eine mögliche Angriffsfläche für Hacker.

Bevor auf die API zugegriffen werden kann, müssen ein paar Vorbereitungen getroffen werden.

Schlägt bereits der direkte Aufruf über die URL fehl, so müssen zunächst die Ursachen dafür behoben werden.

Aufruf:

http://localhost/wordpress/wc-api/v3/

Ist alles ok, gibt der Aufruf die Daten zur API im JSON-Format zurück. Für diesen Aufruf ist noch keine Autorisierung erforderlich, s.a. Rückgabewerte ohne Autorisierung

.. in Arbeit

Aufruf:

http://localhost/wordpress/wc-api/v3/
[store] => stdClass Object
  (
    [name] => major's Blog!
    [description] => Just another WordPress site
    [URL] => http://localhost/wordpress
    [wc_version] => 2.6.14
    [routes] => stdClass Object
      (
        [/] => stdClass Object
          (
            [supports] => Array
              (
                [0] => HEAD
                [1] => GET
              )

            [meta] => stdClass Object
              (
                [self] => http://localhost/wordpress/wc-api/v2/
              )

          )

Kunden (engl. custumers)

        [/customers] => stdClass Object
          (
            [supports] => Array
              (
                [0] => HEAD
                [1] => GET
                [2] => POST
              )

            [meta] => stdClass Object
              (
                [self] => http://localhost/wordpress/wc-api/v2/customers
              )

            [accepts_data] => 1
          )

Anzahl Kunden (engl. custumers)

        [/customers/count] => stdClass Object
          (
            [supports] => Array
              (
                [0] => HEAD
                [1] => GET
              )

            [meta] => stdClass Object
              (
                [self] => http://localhost/wordpress/wc-api/v2/customers/count
              )

          )

einzelner Kunde über id

        [/customers/<id>] => stdClass Object
          (
            [supports] => Array
              (
                [0] => HEAD
                [1] => GET
                [2] => POST
                [3] => PUT
                [4] => PATCH
                [5] => DELETE
              )

            [accepts_data] => 1
          )

        [/customers/email/<email>] => stdClass Object
          (
            [supports] => Array
              (
                [0] => HEAD
                [1] => GET
              )

          )

        [/customers/<id>/orders] => stdClass Object
          (
            [supports] => Array
              (
                [0] => HEAD
                [1] => GET
              )

          )

        [/customers/<id>/downloads] => stdClass Object
          (
            [supports] => Array
              (
                [0] => HEAD
                [1] => GET
              )

          )

        [/customers/bulk] => stdClass Object
          (
            [accepts_data] => 1
            [meta] => stdClass Object
              (
                [self] => http://localhost/wordpress/wc-api/v2/customers/bulk
              )

            [supports] => Array
              (
                [0] => POST
                [1] => PUT
                [2] => PATCH
              )

          )

Bestellungen (engl. orders)

        [/orders] => stdClass Object
          (
            [supports] => Array
              (
                [0] => HEAD
                [1] => GET
                [2] => POST
              )

            [meta] => stdClass Object
              (
                [self] => http://localhost/wordpress/wc-api/v2/orders
              )

            [accepts_data] => 1
          )

Anzahl der Bestellungen

        [/orders/count] => stdClass Object
          (
            [supports] => Array
              (
                [0] => HEAD
                [1] => GET
              )

            [meta] => stdClass Object
              (
                [self] => http://localhost/wordpress/wc-api/v2/orders/count
              )

          )

        [/orders/statuses] => stdClass Object
          (
            [supports] => Array
              (
                [0] => HEAD
                [1] => GET
              )

            [meta] => stdClass Object
              (
                [self] => http://localhost/wordpress/wc-api/v2/orders/statuses
              )

          )

Bestelldaten über Id

        [/orders/<id>] => stdClass Object
          (
            [supports] => Array
              (
                [0] => HEAD
                [1] => GET
                [2] => POST
                [3] => PUT
                [4] => PATCH
                [5] => DELETE
              )

            [accepts_data] => 1
          )

        [/orders/<order_id>/notes] => stdClass Object
          (
            [supports] => Array
              (
                [0] => HEAD
                [1] => GET
                [2] => POST
              )

            [accepts_data] => 1
          )

        [/orders/<order_id>/notes/<id>] => stdClass Object
          (
            [supports] => Array
              (
                [0] => HEAD
                [1] => GET
                [2] => POST
                [3] => PUT
                [4] => PATCH
                [5] => DELETE
              )

            [accepts_data] => 1
          )

        [/orders/<order_id>/refunds] => stdClass Object
          (
            [supports] => Array
              (
                [0] => HEAD
                [1] => GET
                [2] => POST
              )

            [accepts_data] => 1
          )

        [/orders/<order_id>/refunds/<id>] => stdClass Object
          (
            [supports] => Array
              (
                [0] => HEAD
                [1] => GET
                [2] => POST
                [3] => PUT
                [4] => PATCH
                [5] => DELETE
              )

            [accepts_data] => 1
          )

        [/orders/bulk] => stdClass Object
          (
            [accepts_data] => 1
            [meta] => stdClass Object
              (
                [self] => http://localhost/wordpress/wc-api/v2/orders/bulk
              )

            [supports] => Array
              (
                [0] => POST
                [1] => PUT
                [2] => PATCH
              )

          )

Produkte (engl. products)

        [/products] => stdClass Object
          (
            [supports] => Array
              (
                [0] => HEAD
                [1] => GET
                [2] => POST
              )

            [meta] => stdClass Object
              (
                [self] => http://localhost/wordpress/wc-api/v2/products
              )

            [accepts_data] => 1
          )

Anzahl der Produkte

        [/products/count] => stdClass Object
          (
            [supports] => Array
              (
                [0] => HEAD
                [1] => GET
              )

            [meta] => stdClass Object
              (
                [self] => http://localhost/wordpress/wc-api/v2/products/count
              )

          )

Produkte über Id

        [/products/<id>] => stdClass Object
          (
            [supports] => Array
              (
                [0] => HEAD
                [1] => GET
                [2] => POST
                [3] => PUT
                [4] => PATCH
                [5] => DELETE
              )

            [accepts_data] => 1
          )

        [/products/<id>/reviews] => stdClass Object
          (
            [supports] => Array
              (
                [0] => HEAD
                [1] => GET
              )

          )

        [/products/<id>/orders] => stdClass Object
          (
            [supports] => Array
              (
                [0] => HEAD
                [1] => GET
              )

          )

Produktkategorien

        [/products/categories] => stdClass Object
          (
            [supports] => Array
              (
                [0] => HEAD
                [1] => GET
              )

            [meta] => stdClass Object
              (
                [self] => http://localhost/wordpress/wc-api/v2/products/categories
              )

          )

Produktkategorie über Id

        [/products/categories/<id>] => stdClass Object
          (
            [supports] => Array
              (
                [0] => HEAD
                [1] => GET
              )

          )

        [/products/attributes] => stdClass Object
          (
            [supports] => Array
              (
                [0] => HEAD
                [1] => GET
                [2] => POST
              )

            [meta] => stdClass Object
              (
                [self] => http://localhost/wordpress/wc-api/v2/products/attributes
              )

            [accepts_data] => 1
          )

Produkteigenschaften (engl. product attributes)

        [/products/attributes/<id>] => stdClass Object
          (
            [supports] => Array
              (
                [0] => HEAD
                [1] => GET
                [2] => POST
                [3] => PUT
                [4] => PATCH
                [5] => DELETE
              )

            [accepts_data] => 1
          )

Artikelnummer (sku)

        [/products/sku/<sku>] => stdClass Object
          (
            [supports] => Array
              (
                [0] => HEAD
                [1] => GET
              )

          )

        [/products/bulk] => stdClass Object
          (
            [accepts_data] => 1
            [meta] => stdClass Object
              (
                [self] => http://localhost/wordpress/wc-api/v2/products/bulk
              )

            [supports] => Array
              (
                [0] => POST
                [1] => PUT
                [2] => PATCH
              )

          )

Gutscheine (engl. coupons)

        [/coupons] => stdClass Object
          (
            [supports] => Array
              (
                [0] => HEAD
                [1] => GET
                [2] => POST
              )

            [meta] => stdClass Object
              (
                [self] => http://localhost/wordpress/wc-api/v2/coupons
              )

            [accepts_data] => 1
          )

Anzahl der Gutscheine

        [/coupons/count] => stdClass Object
          (
            [supports] => Array
              (
                [0] => HEAD
                [1] => GET
              )

            [meta] => stdClass Object
              (
                [self] => http://localhost/wordpress/wc-api/v2/coupons/count
              )

          )

Gutscheine über Id

        [/coupons/<id>] => stdClass Object
          (
            [supports] => Array
              (
                [0] => HEAD
                [1] => GET
                [2] => POST
                [3] => PUT
                [4] => PATCH
                [5] => DELETE
              )

            [accepts_data] => 1
          )

        [/coupons/code/<code>] => stdClass Object
          (
            [supports] => Array
              (
                [0] => HEAD
                [1] => GET
              )

          )

        [/coupons/bulk] => stdClass Object
          (
            [accepts_data] => 1
            [meta] => stdClass Object
              (
                [self] => http://localhost/wordpress/wc-api/v2/coupons/bulk
              )

            [supports] => Array
              (
                [0] => POST
                [1] => PUT
                [2] => PATCH
              )

          )

Berichte (engl. reports)

        [/reports] => stdClass Object
          (
            [supports] => Array
              (
                [0] => HEAD
                [1] => GET
              )

            [meta] => stdClass Object
              (
                [self] => http://localhost/wordpress/wc-api/v2/reports
              )

          )

        [/reports/sales] => stdClass Object
          (
            [supports] => Array
              (
                [0] => HEAD
                [1] => GET
              )

            [meta] => stdClass Object
              (
                [self] => http://localhost/wordpress/wc-api/v2/reports/sales
              )

          )

        [/reports/sales/top_sellers] => stdClass Object
          (
            [supports] => Array
              (
                [0] => HEAD
                [1] => GET
              )

            [meta] => stdClass Object
              (
                [self] => http://localhost/wordpress/wc-api/v2/reports/sales/top_sellers
              )

          )

Webhooks (engl. webhooks), bedeutet soviel wie Schnittstelle zum Datentransfer.

        [/webhooks] => stdClass Object
          (
            [supports] => Array
              (
                [0] => HEAD
                [1] => GET
                [2] => POST
              )

            [meta] => stdClass Object
              (
                [self] => http://localhost/wordpress/wc-api/v2/webhooks
              )

            [accepts_data] => 1
          )

        [/webhooks/count] => stdClass Object
          (
            [supports] => Array
              (
                [0] => HEAD
                [1] => GET
              )

            [meta] => stdClass Object
              (
                [self] => http://localhost/wordpress/wc-api/v2/webhooks/count
              )

          )

        [/webhooks/<id>] => stdClass Object
          (
            [supports] => Array
              (
                [0] => HEAD
                [1] => GET
                [2] => POST
                [3] => PUT
                [4] => PATCH
                [5] => DELETE
              )

            [accepts_data] => 1
          )

        [/webhooks/<webhook_id>/deliveries] => stdClass Object
          (
            [supports] => Array
              (
                [0] => HEAD
                [1] => GET
              )

          )

        [/webhooks/<webhook_id>/deliveries/<id>] => stdClass Object
          (
            [supports] => Array
              (
                [0] => HEAD
                [1] => GET
              )

          )

      )

META

    [meta] => stdClass Object
      (
        [timezone] => Europe/London
        [currency] => EUR
        [currency_format] => €
        [currency_position] => right_space
        [thousand_separator] => .
        [decimal_separator] => ,
        [price_num_decimals] => 2
        [tax_included] => 1
        [weight_unit] => kg
        [dimension_unit] => cm
        [ssl_enabled] => 
        [permalinks_enabled] => 1
        [generate_password] => 
        [links] => stdClass Object
          (
            [help] => https://woothemes.github.io/woocommerce-rest-api-docs/
          )

      )

  )

)



^