PyDelhi is organizing a mini PyCon this year with the name PyDelhi Conf. And we all are having a great time working behind the scenes to make it a success. I'm contributing to building up the website for the confrence (conference.pydelhi.org).
So, there was this task of fetching the no. of tickets left for the conference from explara and displaying it on the website. I picked it up and had a look at Explara API. And Bingo! I noticed the tickets end-point, which would contain the remaining tickets in the JSON format.
After several tries and errors, I was not able to authenticate the API. It was either giving me 401 or 403. Then after a day, I contacted Anuvrat & Saurabh on IRC. Also, I reached to Rishabh. Rishabh told me that he was able to authenticate for the app method which uses OAuth2. Then he tried for the user method and told me. And there I am.
Doing a blunder. The Authorization token in the header would be preceeded by 'Bearer' so the header would be:
And then voila, it was authorized. Soon to my surprise, it was giving me E007 which is a custom status code of explara which implies that eventId is incorrect. I just clicked on edit on my event and in the url I found something like
eid/116168
And I thought, yeah, that's the eventId I started passing it. But always I was getting E007. Rishabh was also trying but he was also not able to get the response 200.
At around 12.30 AM Rishabh told me that he's going to sleep, and would try tomorrow. But I decided to try more. I googled on how to find the eventId of explara event, but no concrete answer. I kept on trying, and then decided to have a look at other methods API is offering.
I changed the header and added:
and bingo! I got the ticket status
https://github.com/CuriousLearner/explara-ticket-status | Also forked to PyDelhi: https://github.com/PyDelhi/explara-ticket-status
At 3:05 AM the task was completed, and I was pretty much happy about it. A good learning experience and I hope that someone would find it useful while working with explara api. Lack of examples caused more time on this than was really needed.
Comments !