-
Notifications
You must be signed in to change notification settings - Fork 15
Use meta_key for meta endpoint rather than id #2
Comments
I agree that we should add functionality to enable this endpoint Although I there could be some security risk that I am just not seeing but I think this would make it a lot easier to use since you will not have to call |
I agree with this as to get the right meta data for a user would require 2 calls. In fact, is id kind of useless? |
The reason we picked ID in the first place is because the combination of |
@rmccue thanks for the info! However if the path is /users/{userid}/meta/{id/key} Are you saying that in WP I can have 2 entries under user for the key "abc"? If so then that make sense why you are using id... |
That's correct, yeah. |
My thinking was that it would be good to be able to use eg update_post_meta which uses For the update / delete meta by ID endpoint, you could have eg /wp-json/wp/v2/posts/meta/id route or /wp-json/wp/v2/meta/posts/i] (I am not sure which makes more sense), similar-ish to categories. Then |
The issue is with updating/deleting meta. Does |
It works just like
So I guess I think of the |
I agree with @tharsheblows - when using keys it should work like the internal functions do. |
Related is this: sc0ttkclark/wordpress-fields-api#39 Currently the Fields API is using I don't know if eg |
I've been working through adding in public contexts and using the additional bits in the discussion here: [https://core.trac.wordpress.org/ticket/35658](Provide additional data for registered meta through register_meta) and realised that the way I've done it, it would make more sense to have the individual meta endpoint be the meta_key rather than the meta ID as everything goes as meta_key or meta_key, meta_value. Ie the ID isn't used in
update_{$object}_meta
ordelete_{$object}_meta
.Thought I'd ask about it now before continuing down this path. :)
edit: here's a sample response -- it's not complete and I'm not sure about some things but I hope shows where it's headed
The text was updated successfully, but these errors were encountered: