OSSN-API (Open Source Social Networking API) design concept

As a part of Postman API Hackathon I have been making a collection of API (OSSN-API) for building social networking apps or bringing social network capabilities to your existing app . To achieve this I would be using full power of postman ranging from OpenAPI spec to mock server and documents. This project is divided into 3 main parts

  1. Create a well structured OpenAPI 3.0 spec sheet for OSSN-API – The idea is to create a OpenAPI 3.0 spec in yaml file that is filled with lot of examples (Makes it easier for postman to create sensible mock server) and filled with comments to make it easier for humans to read and understand the basic structure and model for implementing the OSSN-API. OpenAPI spec can be found at https://github.com/OSSNAPI/OpenAPI-spec
  2. Create a server side implementation of the api (Open Source) – This part will be done by implementing the specification by building a actual server using Scrawler Framework , this server code would be fully open source and available for anyone to use
  3. Create a fully managed commercial hosting of API – This is the last part and add commercial value to the project, we can deeply integrate our managed service with postman’s monitoring and test suit to give a production grade experience to anyone looking to build their social network on this API

There are few things I have kept in mind while designing the API specification:

  1. The API should be easy to design in any language and should be easy to implement in both MySQL and NoSQL databases
  2. The API should be flexible enough to fit all type of use cases while keeping the structure interoperable, easy to implement and easy to extend.
  3. Posts and User Model should be designed in a way to fit all type of data and posts types while still keeping the database structure similar and api call consistent

To implement this I have kept the model short by only requiring minimum data to have basic social functionality and keeping the model extendable by use of ‘metas’ . Metas are flexible objects inside each model that can store extra useful information to extend the model without changing its implementation or tapering database design for each post type or additional user data.

The whole Social Network API works on these basic model:

  1. User – to store and retrieve user data
  2. Post – this is the basic backbone of social feature, a post can be anything from short tweets, to image based post
  3. Feed – this is used to store interaction between users , user and post and other activity of users. Eg : X likes a post , X is now friends with Y etc. These activities can then be displayed on feed
  4. Like – List of users who have liked a post
  5. Comment – List of comments for a post
  6. UserRelation – this stores relation between two users , this can be used to implement relations like ‘friends’, ‘follow’ or something as complex as ‘circles’ that was introduced by Google +
  7. Message – this stores messeges sent in groups or 1-1 interaction
  8. MessageRoom – this stores the messaging rooms , rooms can be 1-1 messaging rooms or group message rooms. Message rooms are where messages are exchanged

Hope to expand capabilities and flexibility of OSSN-API even further in future even when postman API Hackathon is completed

Leave a Reply

Your email address will not be published. Required fields are marked *