Support

Home Forums Event Espresso Premium Getting error rest_cannot_create_events

Getting error rest_cannot_create_events

Posted: July 13, 2018 at 3:52 pm


gncares

July 13, 2018 at 3:52 pm

I am trying to add an event from my Windows application (C#) and I’m getting an error when I try to add an event.

Here is the full error:

{“code”:”rest_cannot_create_events”,”message”:”Sorry, you are not allowed to create events. Missing permissions: ee_edit_events,ee_edit_others_events,ee_edit_private_events”,”data”:{“status”:403}}

I’ve gone in and made sure the account I’m logging in as has all the permissions necessary.

I am trying this with Cookie Authentication

` string formVars = “”;
string result = “”;
string eventUrl = $”<url>/wp-login.php”;
Dictionary<string, string> headers = new Dictionary<string, string>();
formVars = $”log={UserName}&pwd={Password}”;

Cookie = new System.Net.CookieContainer();

AllowAutoRedirect = false;

result = PerformPost(eventUrl, formVars, true, headers);

Which comes back fine and generates a couple of cookies, but as soon as I try to do a POST to add an event, I get the above error.

Are there any examples of doing this already?

Am I missing something in the configuration?

If my POST message is not formatted correctly, will I get this error or should I be expecting a different type of error?

Any help would be greatly appreciated!


Josh

  • Support Staff

July 13, 2018 at 9:12 pm

Hi,
This sounds like am authentication issue. While you mention cookie authentication, are you following the methods that’s outlined here:

https://developer.wordpress.org/rest-api/using-the-rest-api/authentication/

FYI the Basic Authentication plugin is bundled into Event Espresso so that method is available without adding more plugins to the site.


gncares

July 14, 2018 at 1:26 am

Thank you for the quick response.

I would rather use the Basic Auth than the Cookie Auth, can you give me more details on how that should work?

I am passing in the Header
Authorization: Basic (Base64Encode of Username:Password).


Josh

  • Support Staff

July 14, 2018 at 7:48 am

Here’s a few links to its documentation:

https://github.com/WP-API/Basic-Auth
https://github.com/eventespresso/Basic-Auth/

Please note that the basic auth plugin is bundled with Event Espresso so it’s already installed.


gncares

July 17, 2018 at 12:31 pm

Well, I tried doing a POST with this:

http://<site>/wp-json/ee/v4.8.29/events/?_authorization=Basic <encoded un/pw>

And I still get the error. Is it possible there is another plugin interfering with the authentication?


Josh

  • Support Staff

July 17, 2018 at 12:43 pm

You could try doing a POST (or even a GET) request using an app like Postman, which gives you a UI to add Basic Auth headers. If that doesn’t help, then you can rule out a plugin conflict by temporarily deactivating the other plugins.


gncares

July 17, 2018 at 5:19 pm

Ok, looks like I’m past the Authentication issue, now to figure out what needs to be sent. I’m assuming it’s a Json formatted message.


Tony

  • Support Staff

July 18, 2018 at 1:50 am

I’d recommend you take a look over the EE REST API docs HERE.

You must be logged in to reply to this support post. Sign In or Register for an Account

Support forum for Event Espresso 3 and Event Espresso 4.
Documentation for EE3 and EE4
Documentation for Event Espresso 3

Documentation for Event Espresso 4

Status: publish

Updated by  Tony 3 days, 11 hours ago ago

Topic Tags

Tagged: 

Notifications

This topic is: not resolved
Do NOT follow this link or you will be banned from the site!