SlideShare ist ein Scribd-Unternehmen logo
1 von 47
Open Event API
GH: @aviaryan
TW: @aviaryan123
ABOUT ME
I am a 3rd year CompSci undergrad at IIIT Vadodara, India.
I have been doing software development since 2013.
The first language I developed in was AutoHotkey.
The first (big) project I did was a Bot Editor for Counter Strike.
is.gd/CSBEd
After that, I developed Clipjump which I continued development for 3+
years. is.gd/clipjump
Meanwhile I also developed a lot of AutoHotkey scripts and libraries.
A shout out to the AutoHotkey community for bringing out the
developer in me.
I also started doing some competitive programming in 2014.
Before 2014, I only knew AutoHotkey as a development language. I started
learning new development languages like Python by 2015.
Then I did some open source projects. Everything is public on GitHub.
By 2016, I was confident in Python and some popular frameworks, hence I
managed to crack GSoC.
GSoC 2016 was one of the most memorable periods of my life. It feels my
life changed exponentially during that time.
Then I had a chance to mentor students in Google Code-In under FOSSASIA.
Right now, I work as a contract developer at Appbase.io.
I mainly do backend and Android (ND) development.
Scripting and Web scraping intrigue me.
Me and FOSSASIA
I came to know about FOSSASIA through GSoC 2016. Since then, I have tried to
be active with FOSSASIA and contribute to it whenever possible.
“ FOSSASIA has a very friendly and open community. I think this is what I
like the most about it. Anyone can be a part of it so easily.“
Ok, back to the topic
What’s so about the Open Event project?
Tech Events and Conferences are being organized since the beginning of time.
They are important to propagate ideas, new tools, concepts and for
networking.
It is high time we needed an open, powerful and customizable tool to manage
these events.
Hence, Open Event.
Ah I see, so what’s an API?
API is a way for apps to interact with a server.
Speaking in layman terms, it’s the language in which a server talks to the user.
Like every language, it has a fixed known grammar (syntax).
Updating the grammar requires everyone else knowing about the update.
Credits: restful-api-design.readthedocs.io
API RESPONSE EXAMPLES
{
"success": true,
"data": {
"foo": "bar",
"jam": "dam"
},
"error": null
}
● Status codes, Response-Types, Headers
So why API is needed?
You might have figured it now.
API is the bridge that connects a backend server to the rest of the world. Eg >
Android apps, websites.
A little about the codebase
Open Event server is written in Python (2).
Uses the Flask framework.
Database handled through SQLAlchemy.
DB migrations managed using Alembic.
Beginning to develop the API
Choosing a framework was a very key step. It can so easily affect the entire
of the Open Event project.
We had a few key points in mind -
1. Modular
2. Hackable
3. Ease of Documentation Generation
The Frameworks
● *No framework
● Flask-API
● Flask-restplus
● Flask-restful
Flask-Restplus it is
Why so?
● Writing modular code (namespaces)
● Defining response models clearly
● Auto documentation generation
● Blueprints
● Hackable.. We hacked it to allow custom API requests, input validation,
custom errors.
Structuring the codebase
/app
- /api
- /helpers
- events.py
- users.py
- tracks.py
- .....
- /helpers
- /models
- /static
- /templates
- /views
Defining an API (4 steps)
Create a namespace
Create models (input, output)
Create a Resource
Attach namespace to API
Short Example
from flask import Flask
from flask_restplus import Resource, Api, Namespace
app = Flask(__name__)
api = Api(app)
eventSpace = Namespace('events', description='Events')
api.add_namespace(eventSpace)
@eventSpace.route('/')
class HelloWorld(Resource):
def get(self):
return {'message': 'hello from /events'}
def post(self):
return {'message': 'input = ' + str(self.api.payload)}
if __name__ == '__main__':
app.run()
Open Event API Endpoints
/events
/sessions
/tracks
/speakers
/sponsors
/microlocations
/login
/users
The auto-generated Swagger docs
Docs for the API can be found at
server/api/v1
What’s this sorcery?
Something like this can be achieved by following some conventions.
● Input and Output models are defined distinctly.
● Resources are defined.
● Models are attached to each method (get, post etc) inside resources.
ipModel = eventSpace.model('EventInput', {
'name': fields.String()
})
opModel = eventSpace.model('EventOutput', {
'id': fields.Integer(),
'name': fields.String()
})
@eventSpace.route('/')
class HelloWorld(Resource):
@eventSpace.marshal_with(opModel)
def get(self):
return {'name': 'event name'}
@eventSpace.expect(ipModel)
@eventSpace.marshal_with(opModel)
def post(self):
return {'id': 1, 'name': self.api.payload['name']}
More documentation parameters
● .doc(‘unique_name’, [params])
● .params(‘query_param_name’, ‘description’)
● .response(code, ‘meaning’)
● .header(‘name’, ‘description’)
API Auth
API Auth in Open Event
● For authorization, Open Event allows Basic, JWT and Session based
authentication.
● Basic = username:password , JWT = Token based authentication
● So you can use the full API from any place you prefer (browser, curl,
code).
Example Code (concept)
def requires_auth(f):
@wraps(f)
def decorated(*args, **kwargs):
message = 'Authentication credentials not found'
success = False
# process request
if success:
return f(*args, **kwargs)
else:
raise Exception(message=message)
return decorated
@eventSpace.route('/')
class HelloWorld(Resource):
@requires_auth
def post(self):
return {'id': 1, 'name': self.api.payload['name']}
Import / Export Feature
What’s this?
Import/Export feature of the Open Event is what makes it truly open.
It will allow you to export an event to your computer and then import it back
on any server.
EventYay -> Your PC -> MyEventzz
Why should one use this?
● Use as a event template
● Peace of mind, full backup of your event
● Correctly archive events
Also,
● Exported event can be used to create a static website and app for your
event, is that anything even cooler than that.. And that too for free.
Ok, so what Open Event can do is -
1.Help me to manage my event (CFPs, Tickets etc)
2.Create event’s own app
3.Create a static website for the event
4.And all this is for FREE !!
Working of Import/Export
● Exported event is nothing but the API outflow of the event. They are saved
as single json files.
● To export images, videos etc, they are first added to the zip in an
organized manner and API data refers to them instead of their web url.
● For importing, it’s just the reverse. Feeding the json data to the API to
create the event.
Simple, isn’t it.
Export data file structure
- images
- sponsors
- speakers
- logo.ext
- videos
- audios
- slides
- event
- meta
- speakers
- sponsors
- sessions
- tracks
Background server tasks using Celery
Background tasks, what?
Some tasks should never run on the main thread of the server.
Like sending emails, import event, export event.
We use Celery for queuing tasks to the background.
What is Celery?
Celery is an asynchronous task/job queue based on distributed message
passing.
Uses Redis, a simple key=value store for message passing.
You add tasks to queue and they are run asynchronously, one after another.
Using Celery with Flask
Thanks to the community, we have official libraries for celery and redis in
Python.
pip install celery redis
A short tutorial is at https://is.gd/FlaskCelery
More resources
Me and Shivam (@shivammamgain) worked on the API part. You can visit our
API-related blogs for more info.
Mine’s: https://is.gd/OpenEventApiBlog1
Shivam’s: https://is.gd/OpenEventApiBlog2
THANK YOU. Got Questions?
TW: @aviaryan123

Weitere ähnliche Inhalte

Was ist angesagt?

apidays LIVE Hong Kong 2021 - GraphQL : Beyond APIs, graph your enterprise by...
apidays LIVE Hong Kong 2021 - GraphQL : Beyond APIs, graph your enterprise by...apidays LIVE Hong Kong 2021 - GraphQL : Beyond APIs, graph your enterprise by...
apidays LIVE Hong Kong 2021 - GraphQL : Beyond APIs, graph your enterprise by...apidays
 
apidays LIVE London 2021 - API design is where culture and tech meet each oth...
apidays LIVE London 2021 - API design is where culture and tech meet each oth...apidays LIVE London 2021 - API design is where culture and tech meet each oth...
apidays LIVE London 2021 - API design is where culture and tech meet each oth...apidays
 
Beyond the basic Swagger UI: Adyen API Explorer
Beyond the basic Swagger UI: Adyen API ExplorerBeyond the basic Swagger UI: Adyen API Explorer
Beyond the basic Swagger UI: Adyen API ExplorerAleksei Akimov
 
apidays LIVE New York 2021 - Why Software Teams Struggle with API Security Te...
apidays LIVE New York 2021 - Why Software Teams Struggle with API Security Te...apidays LIVE New York 2021 - Why Software Teams Struggle with API Security Te...
apidays LIVE New York 2021 - Why Software Teams Struggle with API Security Te...apidays
 
Api clarity webinar
Api clarity webinarApi clarity webinar
Api clarity webinarLibbySchulze
 
apidays LIVE Australia 2021 - Confessions of a Product Geek : My First API BY...
apidays LIVE Australia 2021 - Confessions of a Product Geek : My First API BY...apidays LIVE Australia 2021 - Confessions of a Product Geek : My First API BY...
apidays LIVE Australia 2021 - Confessions of a Product Geek : My First API BY...apidays
 
apidays LIVE London 2021 - Moving from a Product as API to API as a Product b...
apidays LIVE London 2021 - Moving from a Product as API to API as a Product b...apidays LIVE London 2021 - Moving from a Product as API to API as a Product b...
apidays LIVE London 2021 - Moving from a Product as API to API as a Product b...apidays
 
Essential Ingredients for a Successful API Program
Essential Ingredients for a Successful API ProgramEssential Ingredients for a Successful API Program
Essential Ingredients for a Successful API ProgramJason Harmon
 
APIdays Zurich 2019 - API management for event driven microservices, Fran Men...
APIdays Zurich 2019 - API management for event driven microservices, Fran Men...APIdays Zurich 2019 - API management for event driven microservices, Fran Men...
APIdays Zurich 2019 - API management for event driven microservices, Fran Men...apidays
 
apidays LIVE London 2021 - API Security challenges and solutions by Wadii Tah...
apidays LIVE London 2021 - API Security challenges and solutions by Wadii Tah...apidays LIVE London 2021 - API Security challenges and solutions by Wadii Tah...
apidays LIVE London 2021 - API Security challenges and solutions by Wadii Tah...apidays
 
apidays LIVE Paris 2021 - Test developer experience, not code by Kathrine Osa...
apidays LIVE Paris 2021 - Test developer experience, not code by Kathrine Osa...apidays LIVE Paris 2021 - Test developer experience, not code by Kathrine Osa...
apidays LIVE Paris 2021 - Test developer experience, not code by Kathrine Osa...apidays
 
apidays LIVE New York - API Code First vs Design First by Phil Sturgeon
apidays LIVE New York - API Code First vs Design First by Phil Sturgeonapidays LIVE New York - API Code First vs Design First by Phil Sturgeon
apidays LIVE New York - API Code First vs Design First by Phil Sturgeonapidays
 
apidays LIVE Hong Kong 2021 - Multi-Protocol APIs at Scale in Adidas by Jesus...
apidays LIVE Hong Kong 2021 - Multi-Protocol APIs at Scale in Adidas by Jesus...apidays LIVE Hong Kong 2021 - Multi-Protocol APIs at Scale in Adidas by Jesus...
apidays LIVE Hong Kong 2021 - Multi-Protocol APIs at Scale in Adidas by Jesus...apidays
 
apidays LIVE Hong Kong 2021 - Automating the API Product Lifecycle by Jeremy ...
apidays LIVE Hong Kong 2021 - Automating the API Product Lifecycle by Jeremy ...apidays LIVE Hong Kong 2021 - Automating the API Product Lifecycle by Jeremy ...
apidays LIVE Hong Kong 2021 - Automating the API Product Lifecycle by Jeremy ...apidays
 
Pain Points In API Development? They’re Everywhere
Pain Points In API Development? They’re EverywherePain Points In API Development? They’re Everywhere
Pain Points In API Development? They’re EverywhereNordic APIs
 
APIdays Helsinki 2019 - Balancing Between Internal and External Developer (AP...
APIdays Helsinki 2019 - Balancing Between Internal and External Developer (AP...APIdays Helsinki 2019 - Balancing Between Internal and External Developer (AP...
APIdays Helsinki 2019 - Balancing Between Internal and External Developer (AP...apidays
 
apidays LIVE Paris 2021 - Automating API Documentation by Ajinkya Marudwar, G...
apidays LIVE Paris 2021 - Automating API Documentation by Ajinkya Marudwar, G...apidays LIVE Paris 2021 - Automating API Documentation by Ajinkya Marudwar, G...
apidays LIVE Paris 2021 - Automating API Documentation by Ajinkya Marudwar, G...apidays
 
apidays LIVE Australia 2020 - Contract-first API development with Spot by Fra...
apidays LIVE Australia 2020 - Contract-first API development with Spot by Fra...apidays LIVE Australia 2020 - Contract-first API development with Spot by Fra...
apidays LIVE Australia 2020 - Contract-first API development with Spot by Fra...apidays
 

Was ist angesagt? (20)

apidays LIVE Hong Kong 2021 - GraphQL : Beyond APIs, graph your enterprise by...
apidays LIVE Hong Kong 2021 - GraphQL : Beyond APIs, graph your enterprise by...apidays LIVE Hong Kong 2021 - GraphQL : Beyond APIs, graph your enterprise by...
apidays LIVE Hong Kong 2021 - GraphQL : Beyond APIs, graph your enterprise by...
 
apidays LIVE London 2021 - API design is where culture and tech meet each oth...
apidays LIVE London 2021 - API design is where culture and tech meet each oth...apidays LIVE London 2021 - API design is where culture and tech meet each oth...
apidays LIVE London 2021 - API design is where culture and tech meet each oth...
 
Beyond the basic Swagger UI: Adyen API Explorer
Beyond the basic Swagger UI: Adyen API ExplorerBeyond the basic Swagger UI: Adyen API Explorer
Beyond the basic Swagger UI: Adyen API Explorer
 
apidays LIVE New York 2021 - Why Software Teams Struggle with API Security Te...
apidays LIVE New York 2021 - Why Software Teams Struggle with API Security Te...apidays LIVE New York 2021 - Why Software Teams Struggle with API Security Te...
apidays LIVE New York 2021 - Why Software Teams Struggle with API Security Te...
 
Api clarity webinar
Api clarity webinarApi clarity webinar
Api clarity webinar
 
apidays LIVE Australia 2021 - Confessions of a Product Geek : My First API BY...
apidays LIVE Australia 2021 - Confessions of a Product Geek : My First API BY...apidays LIVE Australia 2021 - Confessions of a Product Geek : My First API BY...
apidays LIVE Australia 2021 - Confessions of a Product Geek : My First API BY...
 
apidays LIVE London 2021 - Moving from a Product as API to API as a Product b...
apidays LIVE London 2021 - Moving from a Product as API to API as a Product b...apidays LIVE London 2021 - Moving from a Product as API to API as a Product b...
apidays LIVE London 2021 - Moving from a Product as API to API as a Product b...
 
Essential Ingredients for a Successful API Program
Essential Ingredients for a Successful API ProgramEssential Ingredients for a Successful API Program
Essential Ingredients for a Successful API Program
 
APIdays Zurich 2019 - API management for event driven microservices, Fran Men...
APIdays Zurich 2019 - API management for event driven microservices, Fran Men...APIdays Zurich 2019 - API management for event driven microservices, Fran Men...
APIdays Zurich 2019 - API management for event driven microservices, Fran Men...
 
apidays LIVE London 2021 - API Security challenges and solutions by Wadii Tah...
apidays LIVE London 2021 - API Security challenges and solutions by Wadii Tah...apidays LIVE London 2021 - API Security challenges and solutions by Wadii Tah...
apidays LIVE London 2021 - API Security challenges and solutions by Wadii Tah...
 
apidays LIVE Paris 2021 - Test developer experience, not code by Kathrine Osa...
apidays LIVE Paris 2021 - Test developer experience, not code by Kathrine Osa...apidays LIVE Paris 2021 - Test developer experience, not code by Kathrine Osa...
apidays LIVE Paris 2021 - Test developer experience, not code by Kathrine Osa...
 
apidays LIVE New York - API Code First vs Design First by Phil Sturgeon
apidays LIVE New York - API Code First vs Design First by Phil Sturgeonapidays LIVE New York - API Code First vs Design First by Phil Sturgeon
apidays LIVE New York - API Code First vs Design First by Phil Sturgeon
 
apidays LIVE Hong Kong 2021 - Multi-Protocol APIs at Scale in Adidas by Jesus...
apidays LIVE Hong Kong 2021 - Multi-Protocol APIs at Scale in Adidas by Jesus...apidays LIVE Hong Kong 2021 - Multi-Protocol APIs at Scale in Adidas by Jesus...
apidays LIVE Hong Kong 2021 - Multi-Protocol APIs at Scale in Adidas by Jesus...
 
Api types
Api typesApi types
Api types
 
apidays LIVE Hong Kong 2021 - Automating the API Product Lifecycle by Jeremy ...
apidays LIVE Hong Kong 2021 - Automating the API Product Lifecycle by Jeremy ...apidays LIVE Hong Kong 2021 - Automating the API Product Lifecycle by Jeremy ...
apidays LIVE Hong Kong 2021 - Automating the API Product Lifecycle by Jeremy ...
 
Pain Points In API Development? They’re Everywhere
Pain Points In API Development? They’re EverywherePain Points In API Development? They’re Everywhere
Pain Points In API Development? They’re Everywhere
 
APIdays Helsinki 2019 - Balancing Between Internal and External Developer (AP...
APIdays Helsinki 2019 - Balancing Between Internal and External Developer (AP...APIdays Helsinki 2019 - Balancing Between Internal and External Developer (AP...
APIdays Helsinki 2019 - Balancing Between Internal and External Developer (AP...
 
apidays LIVE Paris 2021 - Automating API Documentation by Ajinkya Marudwar, G...
apidays LIVE Paris 2021 - Automating API Documentation by Ajinkya Marudwar, G...apidays LIVE Paris 2021 - Automating API Documentation by Ajinkya Marudwar, G...
apidays LIVE Paris 2021 - Automating API Documentation by Ajinkya Marudwar, G...
 
apidays LIVE Australia 2020 - Contract-first API development with Spot by Fra...
apidays LIVE Australia 2020 - Contract-first API development with Spot by Fra...apidays LIVE Australia 2020 - Contract-first API development with Spot by Fra...
apidays LIVE Australia 2020 - Contract-first API development with Spot by Fra...
 
What's an api
What's an apiWhat's an api
What's an api
 

Ähnlich wie Open Event API

API Documentation presentation to East Bay STC Chapter
API Documentation presentation to East Bay STC ChapterAPI Documentation presentation to East Bay STC Chapter
API Documentation presentation to East Bay STC ChapterTom Johnson
 
API Documentation -- Presentation to East Bay STC Chapter
API Documentation -- Presentation to East Bay STC ChapterAPI Documentation -- Presentation to East Bay STC Chapter
API Documentation -- Presentation to East Bay STC ChapterTom Johnson
 
API Documentation Workshop tcworld India 2015
API Documentation Workshop tcworld India 2015API Documentation Workshop tcworld India 2015
API Documentation Workshop tcworld India 2015Tom Johnson
 
Survival Strategies for API Documentation: Presentation to Southwestern Ontar...
Survival Strategies for API Documentation: Presentation to Southwestern Ontar...Survival Strategies for API Documentation: Presentation to Southwestern Ontar...
Survival Strategies for API Documentation: Presentation to Southwestern Ontar...Tom Johnson
 
API Workshop: Deep dive into REST APIs
API Workshop: Deep dive into REST APIsAPI Workshop: Deep dive into REST APIs
API Workshop: Deep dive into REST APIsTom Johnson
 
Getting Started with Office 365 Development
Getting Started with Office 365 DevelopmentGetting Started with Office 365 Development
Getting Started with Office 365 DevelopmentDragan Panjkov
 
Practices and tools for building better APIs
Practices and tools for building better APIsPractices and tools for building better APIs
Practices and tools for building better APIsNLJUG
 
Practices and tools for building better API (JFall 2013)
Practices and tools for building better API (JFall 2013)Practices and tools for building better API (JFall 2013)
Practices and tools for building better API (JFall 2013)Peter Hendriks
 
Flutter Festival IIT Goa: Session III
Flutter Festival IIT Goa: Session IIIFlutter Festival IIT Goa: Session III
Flutter Festival IIT Goa: Session IIISEJALGUPTA44
 
API Integration in Web Application
API Integration in Web ApplicationAPI Integration in Web Application
API Integration in Web Applicationijtsrd
 
Playing with parse.com
Playing with parse.comPlaying with parse.com
Playing with parse.comJUG Genova
 
solution Challenge design and flutter day.pptx
solution Challenge design and flutter day.pptxsolution Challenge design and flutter day.pptx
solution Challenge design and flutter day.pptxGoogleDeveloperStude22
 
Opensocial Haifa Seminar - 2008.04.08
Opensocial Haifa Seminar - 2008.04.08Opensocial Haifa Seminar - 2008.04.08
Opensocial Haifa Seminar - 2008.04.08Ari Leichtberg
 
Collaboration Portal for Researchers
Collaboration Portal for ResearchersCollaboration Portal for Researchers
Collaboration Portal for ResearchersFatemeh Khast Khoda
 
I Love APIs - Oct 2015
I Love APIs - Oct 2015I Love APIs - Oct 2015
I Love APIs - Oct 2015Mike McNeil
 
BarCamp KL H20 Open Social Hackathon
BarCamp KL H20 Open Social HackathonBarCamp KL H20 Open Social Hackathon
BarCamp KL H20 Open Social Hackathonmarvin337
 
Introjs10.5.17SD
Introjs10.5.17SDIntrojs10.5.17SD
Introjs10.5.17SDThinkful
 
APIdays Paris 2019 - API Descriptions as Product Code by Phil Sturgeon, Stopl...
APIdays Paris 2019 - API Descriptions as Product Code by Phil Sturgeon, Stopl...APIdays Paris 2019 - API Descriptions as Product Code by Phil Sturgeon, Stopl...
APIdays Paris 2019 - API Descriptions as Product Code by Phil Sturgeon, Stopl...apidays
 

Ähnlich wie Open Event API (20)

API Documentation presentation to East Bay STC Chapter
API Documentation presentation to East Bay STC ChapterAPI Documentation presentation to East Bay STC Chapter
API Documentation presentation to East Bay STC Chapter
 
API Documentation -- Presentation to East Bay STC Chapter
API Documentation -- Presentation to East Bay STC ChapterAPI Documentation -- Presentation to East Bay STC Chapter
API Documentation -- Presentation to East Bay STC Chapter
 
Importance Of Alert And Notification In App Dev
Importance Of Alert And Notification In App DevImportance Of Alert And Notification In App Dev
Importance Of Alert And Notification In App Dev
 
API Documentation Workshop tcworld India 2015
API Documentation Workshop tcworld India 2015API Documentation Workshop tcworld India 2015
API Documentation Workshop tcworld India 2015
 
Survival Strategies for API Documentation: Presentation to Southwestern Ontar...
Survival Strategies for API Documentation: Presentation to Southwestern Ontar...Survival Strategies for API Documentation: Presentation to Southwestern Ontar...
Survival Strategies for API Documentation: Presentation to Southwestern Ontar...
 
API Workshop: Deep dive into REST APIs
API Workshop: Deep dive into REST APIsAPI Workshop: Deep dive into REST APIs
API Workshop: Deep dive into REST APIs
 
Getting Started with Office 365 Development
Getting Started with Office 365 DevelopmentGetting Started with Office 365 Development
Getting Started with Office 365 Development
 
Practices and tools for building better APIs
Practices and tools for building better APIsPractices and tools for building better APIs
Practices and tools for building better APIs
 
Practices and tools for building better API (JFall 2013)
Practices and tools for building better API (JFall 2013)Practices and tools for building better API (JFall 2013)
Practices and tools for building better API (JFall 2013)
 
Flutter Festival IIT Goa: Session III
Flutter Festival IIT Goa: Session IIIFlutter Festival IIT Goa: Session III
Flutter Festival IIT Goa: Session III
 
Web Dev 21-01-2024.pptx
Web Dev 21-01-2024.pptxWeb Dev 21-01-2024.pptx
Web Dev 21-01-2024.pptx
 
API Integration in Web Application
API Integration in Web ApplicationAPI Integration in Web Application
API Integration in Web Application
 
Playing with parse.com
Playing with parse.comPlaying with parse.com
Playing with parse.com
 
solution Challenge design and flutter day.pptx
solution Challenge design and flutter day.pptxsolution Challenge design and flutter day.pptx
solution Challenge design and flutter day.pptx
 
Opensocial Haifa Seminar - 2008.04.08
Opensocial Haifa Seminar - 2008.04.08Opensocial Haifa Seminar - 2008.04.08
Opensocial Haifa Seminar - 2008.04.08
 
Collaboration Portal for Researchers
Collaboration Portal for ResearchersCollaboration Portal for Researchers
Collaboration Portal for Researchers
 
I Love APIs - Oct 2015
I Love APIs - Oct 2015I Love APIs - Oct 2015
I Love APIs - Oct 2015
 
BarCamp KL H20 Open Social Hackathon
BarCamp KL H20 Open Social HackathonBarCamp KL H20 Open Social Hackathon
BarCamp KL H20 Open Social Hackathon
 
Introjs10.5.17SD
Introjs10.5.17SDIntrojs10.5.17SD
Introjs10.5.17SD
 
APIdays Paris 2019 - API Descriptions as Product Code by Phil Sturgeon, Stopl...
APIdays Paris 2019 - API Descriptions as Product Code by Phil Sturgeon, Stopl...APIdays Paris 2019 - API Descriptions as Product Code by Phil Sturgeon, Stopl...
APIdays Paris 2019 - API Descriptions as Product Code by Phil Sturgeon, Stopl...
 

Kürzlich hochgeladen

%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...masabamasaba
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesVictorSzoltysek
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park masabamasaba
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024VictoriaMetrics
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park masabamasaba
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfonteinmasabamasaba
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
tonesoftg
tonesoftgtonesoftg
tonesoftglanshi9
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...masabamasaba
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is insideshinachiaurasa2
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrandmasabamasaba
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...masabamasaba
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionOnePlan Solutions
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in sowetomasabamasaba
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...masabamasaba
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Hararemasabamasaba
 

Kürzlich hochgeladen (20)

%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare
 

Open Event API

  • 1. Open Event API GH: @aviaryan TW: @aviaryan123
  • 3. I am a 3rd year CompSci undergrad at IIIT Vadodara, India. I have been doing software development since 2013. The first language I developed in was AutoHotkey. The first (big) project I did was a Bot Editor for Counter Strike. is.gd/CSBEd After that, I developed Clipjump which I continued development for 3+ years. is.gd/clipjump Meanwhile I also developed a lot of AutoHotkey scripts and libraries.
  • 4. A shout out to the AutoHotkey community for bringing out the developer in me. I also started doing some competitive programming in 2014. Before 2014, I only knew AutoHotkey as a development language. I started learning new development languages like Python by 2015. Then I did some open source projects. Everything is public on GitHub. By 2016, I was confident in Python and some popular frameworks, hence I managed to crack GSoC.
  • 5. GSoC 2016 was one of the most memorable periods of my life. It feels my life changed exponentially during that time. Then I had a chance to mentor students in Google Code-In under FOSSASIA. Right now, I work as a contract developer at Appbase.io. I mainly do backend and Android (ND) development. Scripting and Web scraping intrigue me.
  • 6. Me and FOSSASIA I came to know about FOSSASIA through GSoC 2016. Since then, I have tried to be active with FOSSASIA and contribute to it whenever possible. “ FOSSASIA has a very friendly and open community. I think this is what I like the most about it. Anyone can be a part of it so easily.“
  • 7. Ok, back to the topic
  • 8. What’s so about the Open Event project? Tech Events and Conferences are being organized since the beginning of time. They are important to propagate ideas, new tools, concepts and for networking. It is high time we needed an open, powerful and customizable tool to manage these events. Hence, Open Event.
  • 9. Ah I see, so what’s an API? API is a way for apps to interact with a server. Speaking in layman terms, it’s the language in which a server talks to the user. Like every language, it has a fixed known grammar (syntax). Updating the grammar requires everyone else knowing about the update.
  • 11. API RESPONSE EXAMPLES { "success": true, "data": { "foo": "bar", "jam": "dam" }, "error": null } ● Status codes, Response-Types, Headers
  • 12. So why API is needed? You might have figured it now. API is the bridge that connects a backend server to the rest of the world. Eg > Android apps, websites.
  • 13.
  • 14. A little about the codebase Open Event server is written in Python (2). Uses the Flask framework. Database handled through SQLAlchemy. DB migrations managed using Alembic.
  • 16. Choosing a framework was a very key step. It can so easily affect the entire of the Open Event project. We had a few key points in mind - 1. Modular 2. Hackable 3. Ease of Documentation Generation
  • 17. The Frameworks ● *No framework ● Flask-API ● Flask-restplus ● Flask-restful
  • 19. Why so? ● Writing modular code (namespaces) ● Defining response models clearly ● Auto documentation generation ● Blueprints ● Hackable.. We hacked it to allow custom API requests, input validation, custom errors.
  • 20. Structuring the codebase /app - /api - /helpers - events.py - users.py - tracks.py - ..... - /helpers - /models - /static - /templates - /views
  • 21. Defining an API (4 steps) Create a namespace Create models (input, output) Create a Resource Attach namespace to API
  • 22. Short Example from flask import Flask from flask_restplus import Resource, Api, Namespace app = Flask(__name__) api = Api(app) eventSpace = Namespace('events', description='Events') api.add_namespace(eventSpace) @eventSpace.route('/') class HelloWorld(Resource): def get(self): return {'message': 'hello from /events'} def post(self): return {'message': 'input = ' + str(self.api.payload)} if __name__ == '__main__': app.run()
  • 23. Open Event API Endpoints /events /sessions /tracks /speakers /sponsors /microlocations /login /users
  • 25. Docs for the API can be found at server/api/v1
  • 26.
  • 27.
  • 28.
  • 29.
  • 30. What’s this sorcery? Something like this can be achieved by following some conventions. ● Input and Output models are defined distinctly. ● Resources are defined. ● Models are attached to each method (get, post etc) inside resources.
  • 31. ipModel = eventSpace.model('EventInput', { 'name': fields.String() }) opModel = eventSpace.model('EventOutput', { 'id': fields.Integer(), 'name': fields.String() }) @eventSpace.route('/') class HelloWorld(Resource): @eventSpace.marshal_with(opModel) def get(self): return {'name': 'event name'} @eventSpace.expect(ipModel) @eventSpace.marshal_with(opModel) def post(self): return {'id': 1, 'name': self.api.payload['name']}
  • 32. More documentation parameters ● .doc(‘unique_name’, [params]) ● .params(‘query_param_name’, ‘description’) ● .response(code, ‘meaning’) ● .header(‘name’, ‘description’)
  • 34. API Auth in Open Event ● For authorization, Open Event allows Basic, JWT and Session based authentication. ● Basic = username:password , JWT = Token based authentication ● So you can use the full API from any place you prefer (browser, curl, code).
  • 35. Example Code (concept) def requires_auth(f): @wraps(f) def decorated(*args, **kwargs): message = 'Authentication credentials not found' success = False # process request if success: return f(*args, **kwargs) else: raise Exception(message=message) return decorated @eventSpace.route('/') class HelloWorld(Resource): @requires_auth def post(self): return {'id': 1, 'name': self.api.payload['name']}
  • 36. Import / Export Feature
  • 37. What’s this? Import/Export feature of the Open Event is what makes it truly open. It will allow you to export an event to your computer and then import it back on any server. EventYay -> Your PC -> MyEventzz
  • 38. Why should one use this? ● Use as a event template ● Peace of mind, full backup of your event ● Correctly archive events Also, ● Exported event can be used to create a static website and app for your event, is that anything even cooler than that.. And that too for free.
  • 39. Ok, so what Open Event can do is - 1.Help me to manage my event (CFPs, Tickets etc) 2.Create event’s own app 3.Create a static website for the event 4.And all this is for FREE !!
  • 40. Working of Import/Export ● Exported event is nothing but the API outflow of the event. They are saved as single json files. ● To export images, videos etc, they are first added to the zip in an organized manner and API data refers to them instead of their web url. ● For importing, it’s just the reverse. Feeding the json data to the API to create the event. Simple, isn’t it.
  • 41. Export data file structure - images - sponsors - speakers - logo.ext - videos - audios - slides - event - meta - speakers - sponsors - sessions - tracks
  • 42. Background server tasks using Celery
  • 43. Background tasks, what? Some tasks should never run on the main thread of the server. Like sending emails, import event, export event. We use Celery for queuing tasks to the background.
  • 44. What is Celery? Celery is an asynchronous task/job queue based on distributed message passing. Uses Redis, a simple key=value store for message passing. You add tasks to queue and they are run asynchronously, one after another.
  • 45. Using Celery with Flask Thanks to the community, we have official libraries for celery and redis in Python. pip install celery redis A short tutorial is at https://is.gd/FlaskCelery
  • 46. More resources Me and Shivam (@shivammamgain) worked on the API part. You can visit our API-related blogs for more info. Mine’s: https://is.gd/OpenEventApiBlog1 Shivam’s: https://is.gd/OpenEventApiBlog2
  • 47. THANK YOU. Got Questions? TW: @aviaryan123

Hinweis der Redaktion

  1. Add about is.gd here, link shortener ..
  2. This is body. We have status codes, response types, header Status code = traffic lights, colors, sentences, stuff
  3. 3 - work ctsly, need to be updated, so 3 2 - neat codebase, so can hack
  4. Why no framework is even an option? - flask is light, we can create our own minimal helper modules and use them all around. Restplus and restful are similar, but docs.
  5. Not sure.. If it was inspired.. But good way to consume APIs, you will soon see..
  6. Speak about current dev online
  7. Add a screenshot here
  8. Add a screenshot here
  9. Add a screenshot here
  10. Add a screenshot here
  11. This might not make sense to you r.now so let’s go ahead.
  12. This might not make sense to you r.now so let’s go ahead.
  13. Request global object, flask login user object
  14. API endpoints can create apps and websites I think.
  15. Add a meme on top
  16. You get a zip. Zip has this..
  17. THE END