The task given by Appointy completed to develop APIs for a basic version of Instagram.

Instagram APIs

The task given by Appointy completed to develop APIs for a basic version of Instagram.

Create an User
Get User by Id
Create a Post
Get a Post by Id
Get all Posts by an User with Pagination

Setup:

STEP-1 : Install and Set Up MongoDB

            https://docs.mongodb.com/v5.0/installation/

STEP-2 : Clone this repository

            git clone https://github.com/aayush1607/instagram_api.git
            cd instagram-api

STEP-3 : Run local MongoDB instance

            mongo

STEP-4 : Download Dependencies

            go mod download

STEP-5 : Finally Run the Server

            go run main.go

STEP-6 : Then simply navigate in your browser or test the above mentioned APIs on Postman or CURL

APIs :

  1. Create an User
    Method Allowed-POST
    URL http://localhost:8080/users
    JSON Request Body
    {
        "Name":"aayush",
        "Email":"[email protected]",
        "Password": "aayush@1234"
    }
    JSON Response Body
    {
        "InsertedID": "61617acff3b743f10bb0923a"
    }
  2. Get User By id
    Method Allowed-GET
    URL http://localhost:8080/users/?id=61617acff3b743f10bb0923a
    JSON Response Body
    {
        "_id": "61617acff3b743f10bb0923a",
        "name": "aayush",
        "email": "[email protected]",
        "password": "$2a$10$NI5Ub2L2jIePsJu8ljOjBeK.LtfdTj5OoaWV.G7XqU3zuhAF/inCS"
    }
  3. Create a Post
    Method Allowed-POST
    URL http://localhost:8080/posts
    JSON Request Body
    {
        "User": "61615ad9d9a12f1927083b7f",
        "Caption": "Hello Instagram 4",
        "Image_url": "www.insta.com",
        "Timestamp": ""
    }
    JSON Response Body
    {
        "InsertedID": "61616540d9fbb9baedcff879"
    }
  4. Get a Post by id
    Method Allowed-GET
    URL http://localhost:8080/posts/?id=61616540d9fbb9baedcff879
    JSON Response Body
    {
        "_id": "61616540d9fbb9baedcff879",
        "user": "61615ad9d9a12f1927083b7f",
        "caption": "Hello Instagram 4",
        "image_url": "www.insta.com",
        "timestamp": "2021-10-09T09:47:44.93Z"
    }
  5. Get all Posts by user id with pagination
    (limit is the number of posts per page and page is the page number you want to visit. If limit and page parameters are not provided then by default they will be taken as 1)
    Method Allowed-GET
    URL http://localhost:8080/posts/users/?id=61615ad9d9a12f1927083b7f&limit=2&page=1
    JSON Response Body
    {
        "posts": [
            {
                "_id": "6161616aa66d684e5bb38fbc",
                "user": "61615ad9d9a12f1927083b7f",
                "caption": "Hello Instagram",
                "image_url": "www.insta.com",
                "timestamp": "0001-01-01T00:00:00Z"
            },
            {
                "_id": "616161e885e8e66798b7ed78",
                "user": "61615ad9d9a12f1927083b7f",
                "caption": "Hello Instagram 2",
                "image_url": "www.insta.com",
                "timestamp": "2021-10-09T09:33:28.758Z"
            }
        ],
        "total": 4,
        "page": 1,
        "last_page": 2,
        "limit": 2
    }

> Postman API collection link

Packages Used

  1. MongoDB Go Driver to work with mongodb database
  2. Bcrpyt to hash passwords
  3. net/http for response request and response writer
  4. encoding/json for encoding and decoding from json to type struct and vice versa
  5. time for saving current timestamps if not provided by frontend interface

Languages & Tools Used

              

Owner
Aayush Chodvadiya
Backend development | Problem Solving | Worked on multiple freelance projects with @Techlance
Aayush Chodvadiya
Similar Resources

Recruitment task.

Clients-emails project. Description. Microservice that stores clients and send them emails based on mailing ID. The service uses Go and PostgreSQL. Bo

Nov 24, 2021

A Google interview task my friend told me about.

deriving π given a normal distribution Try it yourself: package main import ( "fmt" "github.com/cpmech/gosl/rnd" ) // normal returns a number acc

Dec 16, 2021

Support variable parameters task send worker

go-worker-pool Support variable parameters task send worker 调用方式 go get github.com/214200196/gwp/v1 import ( "fmt" "github.com/214200196/gwp/v1" "

Dec 16, 2021

Stq - Simple Task Queue with REST API

stq Simple Tasks Queue with HTTP API Environments list: Variable Value BACKEND m

Jan 5, 2022

ABAG - The implementation for the alternating trees problem specified in the task

ABAG - GO task This repo contains the implementation for the alternating trees p

Jan 6, 2022

MealPlanr is an application dedicated to the trivial and boring task of meal planning 📅 and generating a shopping list 🛒 .

MealPlanr is an application dedicated to the trivial and boring task of meal planning 📅 and generating a shopping list 🛒 .

MealPlanr is an application dedicated to the trivial and boring task of meal planning 📅 and generating a shopping list 🛒 .

Mar 1, 2022

Run vscode task in command line

vstask Run vscode task in command line install go install "github.com/ttttmr/vstask" usage NAME: vstask - Run vscode task in command line USAGE:

Jul 1, 2022

Prismforce-task - Assignment to test fundamental knowledge for Prism Force

Technical Assignment Assignment to test fundamental knowledge for Prism Force. T

Feb 15, 2022

Job queuing service and async task runner.

Valet Stateless Go server responsible for running tasks asynchronously and concurrently. Overview Job Pipeline Architecture Installation Configuration

Dec 22, 2022
My Simple Instagram-Clone API task submission, conducted by Appointy for internship shortlisting.

go-pointy Go-Pointy is a simple Instagram API Clone, made using GoLang. I had tried my best to not be lazy and finish the tasks, as a beginner to the

Jul 25, 2022
Instagram clone as Appointy task
Instagram clone as Appointy task

Instagram Backend Clone Task for Appointy Internship 2021 Explore the docs » View Demo · Report Bug · Request Feature Table of Contents About the Proj

Oct 11, 2021
Instagram api in go for appointy test
Instagram api in go for appointy test

OFFICEGRAM : Instagram API in Go This is the submission of hiring task for Appointy by: Gunjan Raj Tiwari 19BCE2642 My Experience I heard a lot about

Oct 9, 2021
Tiny go package for fetching high and low value of a stock for any given period range using kite connect historical data APIs.

Tiny go package for fetching high and low value of stock for any given period range using Kite connect Historical data APIs.

Apr 27, 2022
Instagram Messaging API GO SDK

Instagram Messaging API GO SDK Introduction Instabot, Instagram Messaging API GO SDK makes it easy to work with instagram messaging API. It uses Insta

Nov 13, 2022
Instagram API has been solely programmed on Go
Instagram API has been solely programmed on Go

Instagram-API This API has been solely programmed on Go, and for database storage MongoDB has been used. This is originally done as a part of a techni

Feb 6, 2022
Instagram Backend API with golang
Instagram Backend API with golang

Appointy - Task Instagram Backend API 1) Creating an user 2) Getting an user by id 3) Creating a post 4) Getting a post by id 5) Getting List of posts

Oct 3, 2022
This tool is helpful to get information of the Instagram Users

InstaOsint This tool is used to get the public accounts as well as Private accounts like their username, userid, Full_Name, followers and following co

Mar 9, 2022
Groupie Trackers consists on receiving a given API and manipulate the data contained in it, in order to create a site, displaying the information.

groupie-tracker Objectives Groupie Trackers consists on receiving a given API and manipulate the data contained in it, in order to create a site, disp

Jan 13, 2022
ABAG - Go Task

ABAG - Go Task Problem Statement Jimmy owns a garden in which he has planted N trees in a row. After a few years, the trees have grown up and now they

Jul 30, 2022