• Resolved zenjameo

    (@zenjameo)


    Trying to update or create a product via API , but nothing happends.
    Made logging what API is getting and I see POST array is empty:

    [__PHP_Incomplete_Class_Name] => WC_API_Server
        [path] => /products
        [method] => GET
        [params] => Array
            (
                [GET] => Array
                    (
                        [filter] => Array
                            (
                                [post_status] => any
                                [sku] => 1606-010-L/XL
                            )
    
                        [oauth_consumer_key] => 111
                        [oauth_nonce] => 111
                        [oauth_signature] => 111
                        [oauth_signature_method] => 111
                        [oauth_timestamp] => 111
                    )
    
                [POST] => Array
                    (
                    )
    
            )

    any ideas?

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support con

    (@conschneider)

    Engineer

    Hi there,

    What is your exact POST request?
    How do you validate the request? I am guessing oauth2 based? How is this setup?

    Can you make any other authorised request? For example getting post revisions?

    Thread Starter zenjameo

    (@zenjameo)

    hi Con,

    the thing this happends for Woocommerce api only /wc-api/v3/
    /wp-json/wc/ is working just fine.

    yes, it`s oauth2

    here is POST :

    {
    	"product": {
    		"id": "14665",
    		"sku": "1588",
    		"title": "Cleo Soft-BH",
    		"regular_price": "263.2",
    		"weight": "0.1",
    		"tax_class": "standard",
    		"type": "variable",
    		"attributes": [{
    				"name": "Colour",
    				"slug": "colour",
    				"position": 0,
    				"visible": false,
    				"variation": true,
    				"options": ["Black"]
    			}, {
    				"name": "Size",
    				"slug": "size",
    				"position": 0,
    				"visible": false,
    				"variation": true,
    				"options": ["75A", "75B", "85B", "75C", "85C", "75D", "85D", "70B", "80B", "70C", "80C", "70D", "70E", "80D", "80E"]
    			}
    		],....

    What I really can do is with basic auth GET product info like this:
    https://www.byvalerie.com/wc-api/v3/products?consumer_key=ck_0&consumer_secret=cs_7&filter%5Bsku%5D=1588

    But when I`m trying to post something the POST array coming empty into API. Writing server object into log:
    "POST";a:0:{}

    Plugin Support John Coy a11n

    (@johndcoy)

    Automattic Happiness Engineer

    Hi @zenjameo

    This issue is likely caused by the request. Can you review the documentation here to confirm and compare it to your request?

    https://woocommerce.github.io/woocommerce-rest-api-docs/?php#update-a-product

    Let us know what you find.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘/wc-api/v3/ is getting empty POST arrays’ is closed to new replies.