Open joshbruce opened 7 years ago
This works - instead of using send()
// Eventbrite.php
$response = $this->client->post('https://www.eventbriteapi.com/v3/events/:id/?token=:token', [
'headers' => ['Content-Type' => 'application/json'],
'body' => json_encode([
'event.capacity' => 20
])
]);
Also not able to send POST
requests via the SDK.
The tests currently do not cover basic parameter input https://github.com/jamiehollern/eventbrite/blob/master/tests/src/EventbriteTest.php#L140
@CaioBianchi: I don't know if this is bad form or not; so, I do apologize if this is breaking GitHub social norms. Created: https://github.com/8fold/eventbrite-sdk-php
Not as thoroughly tested through PHPUnit and I'm not sure if it covers all the use cases yet. The main project I'm using it in has deviated slightly on priorities, and Eventbrite integration is not it.
Looks good @joshbruce but I see that there's still a lot to be implemented still on the Events
SDK.
I might be able to help, if you're open to contributions/pull requests.
@CaioBianchi: If the assessment is based on the documentation, it is out of date as well (believe most of the get functionality is there - using magic methods)...sorry about that. Always open for contributions and collaborations!
Just an update on the issue here:
I was trying to POST to the access_code
endpoint:
https://www.eventbrite.ca/developer/v3/endpoints/events/#ebapi-post-events-id-access-codes
Which logically would be something like this:
return $this->client->post(sprintf('events/%s/access_codes/', $event_id), $options);
But that was throwing me an error. Once I removed the trailing slash (non-compliant to the documentation) it started working:
return $this->client->post(sprintf('events/%s/access_codes', $event_id), $options);
@CaioBianchi: Don't want to hijack this project. Can we move this to a new issue on the 8fold SDK project?
I'm trying to debug this but I think there could be a few issues going on here:
call
method that needs fixed{"event.capacity": 30}
it seems it should be {"event":{"capacity":30}}
I appreciate you have the other project up and running but if anyone manages to figure this out before I do, please let me know.
@jamiehollern: https://github.com/8fold/eventbrite-sdk-php/blob/develop/src/Classes/Core/ApiClient.php
If you take a look at the __construct
- there's a Guzzle header added on line 94:
$this->config['headers']['Content-Type'] = 'application/json';
I think this alone helped me before I effectively modified the base class here. As to the nesting of JSON, I don't think I had to do anything there json_encode
worked without issue.
Update: I think that single change was enough to make the library more consistent in returning data.
@jamiehollern @joshbruce As mentioned before, it worked for me once I removed the trailing slash, for some reason.
Without having to json_encode
my params.
Hate to be a bother...sorry the other ticket had some of my extensions in there...still think I'm missing something.
Return (note capacity):
Return is the same as above. Verify by recalling.
Return is the same as above.
Again, Postman works just fine - as long as I have it set to form-data.
Thoughts? What am I missing?
Also tried
See also #7