Posted: February 16, 2016 at 3:45 pm
|
Following the instructions to get information for events is working: But trying to GET /registrations (http://mysite/espresso-api/v1/registrations/ge44mm8st4) returns or trying to POST/PUT /registrations (POST http://mysite/espresso-api/v1/registrations/ge44mm8st4) ({ Need some help creating an event registration using a POST/PUT to http://mysite/espresso-api/v1/registrations/ge44mm8st4? Thanks. |
Hi there, If you enable WP_DEBUG it should show additional information when you test again. If you can post that info here it will help narrow the cause down. |
|
|
here is the extra information returned in debug mode: { there is much more but this is the extra information returned from the response to this call. Any help is appreciated. Thanks. |
|
After looking at the output a little more closely here is some more information just before the response is returned that might also be useful. Warning: session_start(): Cannot send session cache limiter – headers already sent (output started at /…/html/wp-includes/functions.php:3792) in /…/html/wp-content/plugins/event-espresso/espresso.php on line 80 Notice: Undefined index: ticket_reservation_time in /…/html/wp-content/plugins/event-espresso/includes/functions/main.php on line 599 Warning: Cannot modify header information – headers already sent by (output started at /…/html/wp-includes/functions.php:3792) in /…/html/wp-content/plugins/espresso-json-api/includes/helpers/EspressoAPI_Response_Formatter.class.php on line 47 |
|
A little more detail that I missed including: The previous response and related information was for a POST to create a new registration. I just ran a request to GET to retrieve all registrations: GET http://mysite/espresso-api/v1/registrations/{ge44mm8st4} and It doesn’t return much at all? Warning: session_start(): Cannot send session cache limiter – headers already sent (output started at /opt/www/mac-apps.ca/html/wp-includes/functions.php:3792) in /opt/www/mac-apps.ca/html/wp-content/plugins/event-espresso/espresso.php on line 80 Warning: Cannot modify header information – headers already sent by (output started at /opt/www/mac-apps.ca/html/wp-includes/functions.php:3792) in /opt/www/mac-apps.ca/html/wp-includes/pluggable.php on line 1228 |
here’s your clue from the debug message: You can follow the format used in the documentation, which show an example where it includes the event information in the request: https://eventespresso.com/wiki/json-api-add-on/#POST.2FPUT_.2Fregistrations |
|
|
Thanks for the response. I actually did that using the exact demo request from the documentation. I can try it again and see if I missed anything from the request. I still don’t understand the issue I get attempting to get a list of all registrations I mentioned before. Trying to GET /registrations (http://mysite/espresso-api/v1/registrations/ge44mm8st4) returns |
It might be the |
|
|
I am still having the same probblem? I can’t GET or POST a registration? I have tried what you have suggested so far. Any further ideas? Thanks. |
If you create a new event within the admin (not using the api) Then add a new registration to that event, again without trying to use the API. Then view the registrations specifically for that event:
What is displayed then?
|
|
|
Hi Tony, I did as you suggested and this is what I see when I run http://mysite.com/espresso-api/v1/events/133/registrations/{session_key} { So it seemingly works for that so far? What else do I need to do? Thanks. |
It looks like on a previous attempt to POST/PUT a registration onto an event the registration was not assigned to any event. Notice in this reply, the output shows:
There’s no event assigned to that registration which is causing the error mentioned. Also the ID of the registrations seems wrong – Can you view that registration within the admin? |
|
|
In checking the admin interface I can’t see the registration from this posting https://eventespresso.com/topic/json-api-using-get-registrations-returns-500-error/#post-192846 should I try and take the example from this posting (https://eventespresso.com/topic/json-api-using-get-registrations-returns-500-error/#post-195336) and use it to attempt to add a registration? |
If by that you mean try to add a registration to that event, you could yes. However make sure you format the registration correctly and assign it to an event but you push it. Basically it sounds like when you first tried to add a registration using the API you did not provide an event for the registration, the API is pulling the registration but doesn’t know what event it should be for and throws an error. Event Espresso itself will not create registrations that are not assigned to an event, which is why the registrations display fine when you view the registrations for the new test event. Before going any further I highly recommend creating a database backup. You will likely need to remove that registration from the database (or assign it to an the event it was intended for) for the registrations endpoint to work correctly again. Take a look within the {prefix}_events_attendee table (likely wp_events_attendee) and see if you can find a registration with the ID 4488.0 Compare it with another registration and follow the format to fix it, or simply remove that row an see if the registrations endpoint works again. If you are unsure of any of the above I would recommend contacting a developer who can work through this with you, you need be careful when editing your database and always make a backup before making any changes. |
|
|
Thanks for the help. I did as you suggested and removed the previous registration attempts from the db and then retried. It looks like it is not working correctly. I still can’t get a list of all registrations but I needed to be able to create a registration for an event and it looks like I can do that now. I have one other question. Can I process a payment through paypal using the JSON API? Thanks again. |
Are you sure you removed all of the problem registrations?
I don’t believe you can process any payments within the API but I will check with the developers on this. |
|
The support post ‘JSON API using GET /registrations returns 500 error’ 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.