• Resolved jkellis

    (@jigirene)


    I’m having trouble executing the cron process with the REST-API endpoint https://mydomain.com/wp-json/import-users-from-csv-with-meta/v1/execute-cron/. I’m authenticating with admin user credentials and still keep getting a 401 error that I’m not authorized. Could you please help me figure out what I’m doing wrong here?

    Here’s the error message I get:

    statusCode 400

    error Bad Request

    message {“code”:”rest_forbidden”,”message”:”Sorry, you are not allowed to do that.”,”data”:{“status”:401}}

    data {“code”:”rest_forbidden”,”message”:”Sorry, you are not allowed to do that.”,”data”:{“status”:401}}

    metadata {“request”:{“url”:”https://mydomain.com/wp-json/import-users-from-csv-with-meta/v1/execute-cron&#8221;,”method”:”GET”,”body”:null,”headers”:{“User-Agent”:”Retool/2.0 (+https://docs.tryretool.com/docs/apis)”,”Authorization”:”—sanitized—“,”ot-baggage-requestId”:”undefined”,”x-datadog-trace-id”:”4280003852161843933″,”x-datadog-parent-id”:”537839590573450081″,”x-datadog-sampling-priority”:”-1″,”traceparent”:”00-00000000000000003b65a0d3bd6902dd-0776ca420e45a361-00″,”tracestate”:”dd=s:-1″,”X-Retool-Forwarded-For”:”35.90.103.133″}},”headers”:{“date”:[“Fri, 23 Feb 2024 09:58:10 GMT”],”server”:[“Apache”],”x-powered-by”:[“PHP/7.4.33″],”x-xss-protection”:[“1; mode=block”],”strict-transport-security”:[“max-age=31536000; includeSubDomains”],”referrer-policy”:[“strict-origin-when-cross-origin”],”x-frame-options”:[“sameorigin”],”access-control-allow-origin”:[“*”],”x-robots-tag”:[“noindex”],”link”:[“<https://mydomain.com/wp-json/&gt;; rel=\”https://api.w.org/\””],”x-content-type-options”:[“nosniff”],”access-control-expose-headers”:[“X-WP-Total, X-WP-TotalPages, Link”],”access-control-allow-headers”:[“Authorization, X-WP-Nonce, Content-Disposition, Content-MD5, Content-Type”],”bbp-unread-messages”:[“323″],”vary”:[“Origin,Accept-Encoding”],”upgrade”:[“h2,h2c”],”connection”:[“Upgrade, Keep-Alive”],”keep-alive”:[“timeout=5″],”transfer-encoding”:[“chunked”],”content-type”:[“application/json; charset=UTF-8″]},”status”:401,”statusText”:”Unauthorized”}

Viewing 1 replies (of 1 total)
  • Plugin Author Javier Carazo

    (@carazo)

    REST API calls must have the same level of authentication as if they were calls made internally.

    You are probably not authenticated with a sufficient level of permissions.

    Make the call by authenticating with a user that has a sufficient role to do a user import operation.

    If not, imagine what a security hole this would be.

Viewing 1 replies (of 1 total)
  • The topic ‘Call cron process using REST-API’ is closed to new replies.