Support

Home Forums Event Espresso Premium Event Espresso 4 Core Regular v4.9.64.p (API)

Event Espresso 4 Core Regular v4.9.64.p (API)

Posted: July 4, 2018 at 8:36 am


gint

July 4, 2018 at 8:36 am

How can i enable ant test if the api is working ?


Tony

  • Support Staff

July 4, 2018 at 10:52 am

You don’t need to enable the API, as long as the WP REST API is enabled EE hooks into that and works with it.

To test if it’s working depends on the details you want to pull, but if you visit:

{domain.com}/wp-json/ee/v4.8.36/events

And see details of your events, the API is working.

Another example is:

{domain.com}/wp-json/ee/v4.8.36/site_info

If you see details of your site, the API is working.

If you let us know what you are trying to do with the API we may be able to point you in the right direction.


gint

July 4, 2018 at 10:56 am

Ι am trying a get to the following endpoint with basic auth (user name and password)
https://test.nbedu.org/wp-json/ee/v4.8.36/registrations
and i get
{
“code”: “rest_registrations_cannot_list”,
“message”: “Sorry, you are not allowed to list registrations. Missing permissions: ee_read_registrations,ee_read_others_registrations”,
“data”: {
“status”: 403
}
}


Tony

  • Support Staff

July 4, 2018 at 11:08 am

Your server may not be passing the authorization header, try the steps posted here:

https://eventespresso.com/wiki/ee4-event-apps/#app-error

(The EE4 apps use the API to communicate with your site, which is why the page page above is from the app documentation)


gint

July 4, 2018 at 11:11 am

ok thanks the problem was the user role


Tony

  • Support Staff

July 4, 2018 at 11:16 am

Ah, right.

By default, you’ll need to use an Admin account as that has all of the EE capabilities assigned to it.


gint

July 4, 2018 at 11:28 am

Finally i am testing a PUT with the following endpoint

https://test.nbedu.org/wp-json/ee/v4.8.36/registrations/?EVT_ID=12&ATT_ID=60&TXN_ID=61&TKT_ID=62&STS_ID=RIC

and i am getting

{
“code”: “rest_no_route”,
“message”: “No route was found matching the URL and request method”,
“data”: {
“status”: 404
}
}

Any help on this ?


Josh

  • Support Staff

July 4, 2018 at 11:43 am

Hi there,

I’m afraid that is not correct syntax. Here’s a link to the API documentation for writing data that include examples of how to make specific API calls:

https://github.com/eventespresso/event-espresso-core/blob/master/docs/C–REST-API/ee4-rest-api-writing-data.md


gint

July 5, 2018 at 12:22 am

Hi i am sending a POST with the following parameters
https://test.nbedu.org/wp-json/ee/v4.8.36/registrations/?REG_ID=30&EVT_ID=12&ATT_ID=14&TXN_ID=1&TKT_ID=2&STS_ID=RAP&REG_date&REG_final_price&REG_paid&REG_session
and body

{
“Registrations”:[
{
“id”:”new-one”,
“status”:”not_approved”,
“date_of_registration”:”2012-12-10 16:12:31″,
“final_price”:10,
“code”:”1-50c67a6f172e1″,
“url_link”:null,
“is_primary”:true,
“is_group_registration”:false,
“is_going”:true,
“is_checked_in”:true,
“Event”:{
“id”:12,
“code”:”1-50c679c10fcf0″,
“name”:”test”,
“description”:””,
“status”:”active”,
“limit”:999999,
“group_registrations_allowed”:true,
“group_registrations_max”:3,
“active”:true,
“member_only”:false,
“virtual_url”:””,
“call_in_number”:””,
“phone”:””,
“metadata”:{
“default_payment_status”:””,
“venue_id”:””,
“additional_attendee_reg_info”:3,
“add_attendee_question_groups”:{
“1”:”1″
},
“date_submitted”:”December 11, 2012″,
“event_hashtag”:””,
“event_format”:””,
“event_livestreamed”:””,
“”:””
}
},
“Attendee”:{
“id”:”new-one2″,
“firstname”:”fromapi”,
“lastname”:”fromapiman”,
“address”:””,
“address2″:””,
“city”:””,
“state”:””,
“country”:””,
“zip”:””,
“email”:”test@test.com”,
“phone”:””
},
“Transaction”:{
“id”:”new-one3″,
“timestamp”:”2012-12-10 16:12:31″,
“total”:10,
“amount_paid”:0,
“status”:”pending”,
“details”:null,
“tax_data”:null,
“session_data”:null,
“payment_gateway”:”Check”
},
“Datetime”:{
“id”:20,
“is_primary”:true,
“event_start”:”2012-12-11 09:00:00″,
“event_end”:”2012-12-10 17:00:00″,
“registration_start”:”2012-12-09 00:01:00″,
“registration_end”:”2016-12-21 23:59:00″,
“limit”:999999,
“tickets_left”:999984
},
“Price”:{
“id”:12,
“name”:”General Admission”,
“amount”:10,
“description”:null,
“limit”:9999999,
“remaining”:999999,
“start_date”:null,
“end_date”:null,
“Pricetype”:{
“id”:1,
“name”:”Base Price”,
“is_member”:false,
“is_discount”:false,
“is_tax”:false,
“is_percent”:false,
“is_global”:true,
“order”:0
}
}
}
]
}

AND i am getting

{“code”:”invalid_field”,”message”:”You have provided an invalid parameter: “Registrations””,”data”:null}


Josh

  • Support Staff

July 5, 2018 at 3:09 pm

Hi,

I’ll point to the direction of the documentation again, specifically here:
https://github.com/eventespresso/event-espresso-core/blob/master/docs/C–REST-API/ee4-rest-api-writing-data.md#how-to-send-arguments

You’ll note that it mentions:

You can either send the arguments either in the url-encoded body of the requests or as a JSON body

It appears that you’re trying to provide some arguments within the query string, which the REST API will likely ignore.

Also, it looks like you’re trying to create a bunch of entries simultaneously. The REST API doesn’t actually work that way. Instead, you will need to create each record individually, one per request.

The support post ‘Event Espresso 4 Core Regular v4.9.64.p (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.

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: closed

Updated by  Josh 5 months, 1 week ago ago

Topic Tags

Tagged: 

Notifications

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