gncares
April 3, 2019 at 4:53 pm
I can easily relate a Venue to Event via the REST API:
Post to //…/wp-json/ee/v4.8.29/event_venues/
with:
{ “EVT_ID”: “1029”, “VNU_ID”: “488”}
However, if there is already a Venue related to the event it doesn’t change the venue.
What do I need to do to get it to change which venue is associated with the event?
gncares
April 8, 2019 at 1:35 am
Add New Note to this Reply
Anyone?
Josh
April 8, 2019 at 9:12 am
Add New Note to this Reply
Hi,
You mentioned doing a POST request but the documentation says to PUT or PATCH when updating an entity. Have you tried sending either a PUT or a PATCH request?
gncares
April 8, 2019 at 5:13 pm
Add New Note to this Reply
I’ll give that a shot. Thanks!
gncares
April 9, 2019 at 4:35 pm
Add New Note to this Reply
Using PUT didn’t help. I get a 404 error.
So now I’m looking at the venues related to the event and I’m trying to delete the relationships.
DELETE `https://…/wp-json/ee/v4.8.29/events/1031/event_venues/598`
and I’m getting a 404 Error for that. The EventID is 1031, the Venue ID is 598.
My DELETE was based on the documentation here:
https://github.com/eventespresso/event-espresso-core/blob/master/docs/C–REST-API/ee4-rest-api-editing-relations.md
Josh
April 9, 2019 at 10:16 pm
Add New Note to this Reply
The documentation actually shows to use v4.8.36. I do not think the write endpoints were included in v4.8.29.
gncares
April 9, 2019 at 11:05 pm
Add New Note to this Reply
So I need to upgrade Espresso?
Tony
April 10, 2019 at 1:50 am
Add New Note to this Reply
No, theres mutliple version of the EE REST API and right now you are using v4.8.29:
DELETE `https://…/wp-json/ee/v4.8.29 /events/1031/event_venues/598`
The latest version of the API is v4.8.36
DELETE `https://…/wp-json/ee/v4.8.36 /events/1031/event_venues/598`
v4.8.36
gncares
April 10, 2019 at 3:04 pm
Add New Note to this Reply
The version number made no difference.
DELETE `https://…/wp-json/ee/v4.8.36/events/1032/event_venues/598`
{ “force”: “1” }
The response I get is:
{“code”:”rest_no_route”,”message”:”No route was found matching the URL and request method”,”data”:{“status”:404}}
Josh
April 11, 2019 at 8:01 pm
Add New Note to this Reply
DELETE /wp-json/ee/v4.8.36/events/1032/venues/598
is the syntax if you’re removing venue ID 598 from event ID 1032
gncares
April 12, 2019 at 1:00 am
Add New Note to this Reply
That worked, thank you.