• Hyflex

    (@hyflex)


    Hi,

    I am using WordPress & WishlistMember & Simple:Press Forums, I am looking for some advice and answers to a few queries that I have.

    1. As far as I can see the WP API doesn’t allow you by default to get a users email for example? Would I need a custom endpoint for this?

    2. As far as I can see the WishlistMember plugin doesn’t have any REST API functionality so to get user information like their membership status we would need another custom endpoint to utilize theie wordpress functions/api: https://codex.wishlistproducts.com/ maybe just to the following https://codex.wishlistproducts.com/function-reference-wlmapi_get_member/

    3. As far as I can see the Simple:Press forum plugin doesn’t have any REST API functionality so to create a post/reply on the forum we would need to create another custom endpoint to utilize wordpress functions/api: https://simple-press.com/documentation/api/

    4. I have a custom plugin that saves certain information to a separate table in the database, it’s basically meta data which relates to a user but I hold it in a separate table; how can I retrieve/update that information via the WP REST API? Likewise what if the data existed in user_meta, how would I update that information?

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    The user email is available through the API, but the request must be properly authenticated and the authenticated user must have proper WP capability to view user data.

    I’m not familiar with those plugins, but if they do not support the API themselves, then yes, you can build your own route/endpoints to get at the data. Same goes for custom table data, build your own.

    Actual user meta is available through the /users/<id> route. The meta keys need to be explicitly registered to be accessible through the API, and again, proper authentication and capability is required. Given those requirements are met, POST an update to the proper /users/<id> route with all fields that need to be updated passed in the POST request. The ‘meta’ item is sent as an array of key => value pairs. All JSON encoded of course.

Viewing 1 replies (of 1 total)
  • The topic ‘WP REST API’ is closed to new replies.