Posted: 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 = “”; 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! |
Hi, 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. |
|
|
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 |
Here’s a few links to its documentation: https://github.com/WP-API/Basic-Auth Please note that the basic auth plugin is bundled with Event Espresso so it’s already installed. |
|
|
Well, I tried doing a POST with this: /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? |
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. |
|
|
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. |
I’d recommend you take a look over the EE REST API docs HERE. |
|
The support post ‘Getting error rest_cannot_create_events’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.