• Resolved dunnpost

    (@dunnpost)


    Hi all,

    trying to update a product custom field(created with ACF plugin), filed is called “precio1”

    Using Postman, I see it when I make a GET(as meta_data)

    I am trying to update it from POSTMAN and Terminal, using this request

    curl -X PUT https://MYHOSTNAME/wp-json/wc/v3/products/296
    
    -u ck_XXXXXXXXX:cs_XXXX (ck and cs are OK the user is the WP admin so really ellevated)
    
    -H "Content-Type: application/json"
    
    -d '{
    
    "product": {
    
    "meta_data": {
    
    "key": "precio1",
    
    "value": "1234"
    
    }
    
    }
    
    }'

    When I send this request I get:

    {"code":"woocommerce_rest_cannot_edit","message":"Lo siento, no tienes permiso para editar este recurso.","data":{"status":401}}zsh: command not found: -u zsh: command not found: -H zsh: command not found: -d 

    I already consulted the full desciption of the v3 API, specially about Authentication and dozens of forums during the last 2 days, I need some help……. What I am doing wrong? Thank you in advance

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

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hey there, @dunnpost! Thanks for contacting us. I’m happy to help you.

    If you try to update a default WooCommerce field, do you get the same error? Or does it only happen with the one you added via the third-party plugin?

    Furthermore, I’d like to understand your site properly. Please share with us the necessary information below for us to investigate the issue further:

    System Status Report which you can find via WooCommerce > Status > Get system report > Copy for support.
    Fatal error logs (if any) under WooCommerce > Status > Logs.
    You could copy and paste your reply here or paste it via https://gist.github.com/ and send the link here.

    Looking forward to your reply.

    Have a wonderful day!

    Thread Starter dunnpost

    (@dunnpost)

    Carolm29, thanks for your interest and willigness to help…

    Yes same error with acore Woocommerce field.

    REQUEST: 
    
    curl -X PUT https://www.dmacmini.com/wp-json/wc/v3/products/296
        -u ck_4e9e70d496acbebc093db2bb445ad905d1e71e19:cs_9a473e91bf625db06a81c00d1afa0312d8e9464f 
        -H "Content-Type: application/json" 
        -d '{
      "product": {
        "price": "777824.54"
      }
    }'
    RESPONSE
    {"code":"woocommerce_rest_cannot_edit","message":"Lo siento, no tienes permiso para editar este recurso.","data":{"status":401}}zsh: command not found: -u
    zsh: command not found: -H
    zsh: command not found: -d

    If I send a incomplete PUT request, like this one:

    curl -X PUT https://www.dmacmini.com/wp-json/wc/v3/products/296
        -u ck_4e9e70d496acbebc093db2bb445ad905d1e71e19:cs_9a473e91bf625db06a81c00d1afa0312d8e9464f 
        -H "Content-Type: application/json" 
        -d '{
      "product": {
      }
    }'
    {"code":"woocommerce_rest_cannot_edit","message":"Lo siento, no tienes permiso para editar este recurso.","data":{"status":401}}zsh: command not found: -u
    zsh: command not found: -H
    zsh: command not found: -d

    I get same error. It looks like an Auth error, but I have generated 2 new cs and ck pair attached to an administrator account, and I tried with them, I got same result.

    Regarding logs

    https://www.themacmini.com/wp-content/uploads/2024/01/SystemStatusReport_www.dmacmini.com_2024-01-24T22-16-38.txt

    Logs for critical errors:none, only this one:

    2024-01-22T22:31:35+00:00 INFO Version: 3, Route: /products/296, User agent: curl/8.4.0

    I keep on trying and appreciate your proposals for solution

    Hi there @dunnpost ??

    Thank you for reaching back, with further details on this.

    I get same error. It looks like an Auth error

    Let’s make sure that the API is tested and working, as a next step. Kindly follow the documentation steps, linked here, for doing so.

    Additionally, the main documentation page can be found linked here, and a helpful YouTube video here.

    I hope this is helpful! Please let us know if you have any further questions or concerns.
    We will be happy to help you further.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Cannot update product from APIv3: PUT request’ is closed to new replies.