Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator bcworkz

    (@bcworkz)

    I don’t think WP properly supports PUT transport of data, despite it being assigned a constant in WP_Rest_Server. I was always told from long ago to not rely on PUT, to only use GET POST HEAD. I can’t provide an authoritative reference though. With the API, of course we also need to use DELETE, but POST should suffice for anything that PUT would be used for.

    I understand your concern was mainly to confirm your plugin doesn’t have a problem. It certainly doesn’t appear to be the case.

    Thread Starter chrisadhome

    (@chrisadhome)

    In my experience the WP REST API does support PUT requests.

    I have been using the officially supported Node-WPAPI library without issue, which uses PUT requests to update WP data.

    However, Advanced Custom Fields (ACF) REST API plugin in the authors own words “uses the interface of WordPress classes” – which appear to fail on PUTs.

    Are there any known libraries successfully using the REST API interface classes which are PUTing? That would help determine if this is an issue with interface classes.

    Thanks for the assistance, this seems like an important issue to continue to push the WP REST API ecosystem forward IF it is an issue.

    • This reply was modified 6 years, 10 months ago by chrisadhome.
    Moderator bcworkz

    (@bcworkz)

    I did a quick scan of class-wp-rest-server.php and did not see anything that would support PUT data transfer, it relies on getting data through $_POST. Admittedly, I may have missed something. I’m not that familiar with the API, my initial comment was based on general WP advice I’ve been operating under for years, that PUT should be avoided. It can sometimes work, but is unreliable and is best avoided. There’s no reason to expect that to continue into the API, but from your anecdotal experience, perhaps it should.

    Instead of searching for working examples of PUT use, I’d advise searching through the API source code for where PUT data would be handled. From that, if it exists, you could deduce the proper way to use it.

    Thread Starter chrisadhome

    (@chrisadhome)

    For now I will abandon using the WP REST API / ACF REST API and move over to using WP All Import and bring the data in as a CSV.

    This does seem to be an issue that multiple people are reporting… Perhaps working with the authour of the ACF to REST API plugin you guys could nail down what is going on.

    PUT requests seem significant enough to being flagged as a legit issue.

    Thanks for your consideration.

    • This reply was modified 6 years, 9 months ago by chrisadhome.
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘class-wp-rest-server.php PUT Failure?’ is closed to new replies.