2 added 364 characters in body
source | link

I have been working with the WP REST API and all GET (read) commands pull the data I want from both built in and custom post types (this plugin was a godsend btw to help). I can also POST to create posts with top level information for both built-in and custom post types. All my authentication is working fine. But when I try to update post meta, I have been met by the following response:

{
  "code": "rest_no_route",
  "message": "No route was found matching the URL and request method",
  "data": {
    "status": 404
  }
}

I found reference in this article for the potential need for some extra code to make meta work, and I then found this plugin which DID solve the meta posting problem, but only for the built in posts type (not working with my custom post types, which still return exactly the same error).

All of the above is confusing and compounded I think by the changing capabilities and state of the WP REST API itself.

Can anyone point me to some clear documentation for performing a meta value update on a custom post type?

UPDATE:

ok I just discovered that the rest-api-meta-endpoints plugin mentioned above WILL allow writing to CPTs as well, but via /wp-json/wp/v2/posts/id/meta instead of /wp-json/wp/v2/cptname/id/meta...is this the expected behavior?

That said, for any posts I can only write new data, can't figure out how to update existing meta yet, any ideas?

I have been working with the WP REST API and all GET (read) commands pull the data I want from both built in and custom post types (this plugin was a godsend btw to help). I can also POST to create posts with top level information for both built-in and custom post types. All my authentication is working fine. But when I try to update post meta, I have been met by the following response:

{
  "code": "rest_no_route",
  "message": "No route was found matching the URL and request method",
  "data": {
    "status": 404
  }
}

I found reference in this article for the potential need for some extra code to make meta work, and I then found this plugin which DID solve the meta posting problem, but only for the built in posts type (not working with my custom post types, which still return exactly the same error).

All of the above is confusing and compounded I think by the changing capabilities and state of the WP REST API itself.

Can anyone point me to some clear documentation for performing a meta value update on a custom post type?

I have been working with the WP REST API and all GET (read) commands pull the data I want from both built in and custom post types (this plugin was a godsend btw to help). I can also POST to create posts with top level information for both built-in and custom post types. All my authentication is working fine. But when I try to update post meta, I have been met by the following response:

{
  "code": "rest_no_route",
  "message": "No route was found matching the URL and request method",
  "data": {
    "status": 404
  }
}

I found reference in this article for the potential need for some extra code to make meta work, and I then found this plugin which DID solve the meta posting problem, but only for the built in posts type (not working with my custom post types, which still return exactly the same error).

All of the above is confusing and compounded I think by the changing capabilities and state of the WP REST API itself.

Can anyone point me to some clear documentation for performing a meta value update on a custom post type?

UPDATE:

ok I just discovered that the rest-api-meta-endpoints plugin mentioned above WILL allow writing to CPTs as well, but via /wp-json/wp/v2/posts/id/meta instead of /wp-json/wp/v2/cptname/id/meta...is this the expected behavior?

That said, for any posts I can only write new data, can't figure out how to update existing meta yet, any ideas?

1
source | link

WP REST API "rest_no_route" when trying to update meta

I have been working with the WP REST API and all GET (read) commands pull the data I want from both built in and custom post types (this plugin was a godsend btw to help). I can also POST to create posts with top level information for both built-in and custom post types. All my authentication is working fine. But when I try to update post meta, I have been met by the following response:

{
  "code": "rest_no_route",
  "message": "No route was found matching the URL and request method",
  "data": {
    "status": 404
  }
}

I found reference in this article for the potential need for some extra code to make meta work, and I then found this plugin which DID solve the meta posting problem, but only for the built in posts type (not working with my custom post types, which still return exactly the same error).

All of the above is confusing and compounded I think by the changing capabilities and state of the WP REST API itself.

Can anyone point me to some clear documentation for performing a meta value update on a custom post type?