Support

Home Forums Event Espresso Premium How to obtain a Custom Field value for an event using the API?

How to obtain a Custom Field value for an event using the API?

Posted: January 1, 2021 at 7:02 pm


Kevin Pinto

January 1, 2021 at 7:02 pm

I have defined a custom field named OnlineURL for an event as shown in the picture.

Custom Field screenshot

How do I obtain this using the API? I am able to get many Event fields, but cannot figure out where this field value is stored.


Kevin Pinto

January 1, 2021 at 7:03 pm

Link to the image is here


Tony

  • Support Staff

January 4, 2021 at 5:09 am

Hi there,

Which API are you referring to? REST API?

If so you’ll need to send an authenticated request to:

/wp-json/ee/v4.8.36/events/{event_id}/post_metas

Is that what you are looking for?


Kevin Pinto

January 10, 2021 at 6:58 pm

Yes, the REST API.

Is there an easy guide to REST API authentication?


Tony

  • Support Staff

January 11, 2021 at 7:48 am

Using PHP?

You send an additional ‘Authorization’ with the username:password base64 encoded like so:

'Authorization' => 'Basic ' . base64_encode( 'username:password' )

There some details here:

https://code.tutsplus.com/tutorials/wp-rest-api-setting-up-and-using-basic-authentication–cms-24762

The support post ‘How to obtain a Custom Field value for an event using the API?’ 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.

Event Espresso