Skip to main content
Question

WordPress Get Webhook by Zapier issues - just lists admins or returns a 401 error


Hello,

Would very much appreciate some help on this as I have been through the forums and tried a lot of different suggestions.

I am trying to us a Get request to retrieve user data from WordPress, namely I’d like the users email so I can use it later in the Zap.

Zapier is connected to WordPress via my admin account which has list user privileges. I do have some authentication plugins which I deactivated and it made no difference.

I suppose my first question is am I using the query string parameters correctly:

I’m want to find a user with a specific ID. If I just include that query string parameter (or no parameters) I get a list of admins and no error. Which I believe is because those users have has_published_posts as true...

If I include the context::edit parameter I get and error: Failed to create a request in Webhooks by Zapier
Sorry, you are not allowed to list users. (HTTP Status Code: 401)
.

Any help much appreciated as I’m completely stuck

Thanks in advance

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

10 replies

Userlevel 7
Badge +14

Hi @DisruptiveHR 

What is the link to the WordPress API endpoint documentation you referenced to configure the Zap step API request?

Sorry I should of added that in too: https://developer.wordpress.org/rest-api/reference/users/#list-users

Userlevel 7
Badge +14

@DisruptiveHR 

From the API endpoint documentation there is no argument for “id”.

Perhaps you meant to use “include”.

 

Hi Troy,

Thanks for getting back to me. I think it depends on what kind of Get you are using from that page:

 

I did try using “include” initially but I get the same result. It shows me a list of admins.

I feel like this might be more of a permissions thing but I have Zapier connected via the WooCommerce/Zapier plugin and the WordPress/Zapier plugin. Do I need to do something custom via the developer area and create my own integration?

Thanks again

Userlevel 7
Badge +14

@DisruptiveHR 

If you are trying to retrieve a specific user, then you would need to include the ID as part of the URL path, and not as a query string parameter

 

Hi Troy,

That was my initial question, was I using the query string parameters correctly. However my confusion is because it states the following regarding query string parameters:

So I assumed if I included the ID it would be appended to the url? How else to I add it to the end of the url dynamically?

Thanks for all the help so far.

I should add that I have tried manually adding the customer id to the GET url (with no query string parameters) and it had no difference to the result.

When I try this it says:

Failed to create a request in Webhooks by Zapier

Invalid user ID. (HTTP Status Code: 404)

Despite the user being in existence and the ID being correct.

Userlevel 7
Badge +14

@DisruptiveHR 

For us to have context about the recent error, post screenshots with how your updated Zap step is now configured.

 

URL path parameters are configured differently from query string parameters.

Path parameters must be set in the URL field in the Zap step.

OK this is what I have now:

And the error:

But I can guarantee that user exists. I’ve searched for 1415 in the Users section in admin and the user I am trying to retrieve is found with that ID.

So I’ve no idea why it’s an invalid ID.

Thanks

Userlevel 7
Badge +14

@DisruptiveHR

Could it be that you are passing a Customer ID instead of a User ID?

Can you post a screenshot showing the existing User with that ID shown in the URL?

 

Do you have your Headers set in the Zap step?

Info: https://developer.wordpress.org/rest-api/requests/#headers

Search for “header” on that page for context.