NAV Navbar
javascript
  • WELCOME TO WEConnect
  • Introduction
  • Development
  • Installation
  • Authentication
  • API requests
  • Users
  • Businesses
  • Reviews
  • Errors
  • WELCOME TO WEConnect

    Introduction

    Welcome to the WEConnect API! WeConnect provides a platform that brings businesses and individuals together. This platform creates awareness for businesses and gives the users the ability to write reviews about the businesses they have interacted with.

    You can use our API to access to acces different businesses. We get You connected to multiple businesses, their reviews and profiles. Our API also allows You to add a business to the platform too.

    Our language of choice here is node and express was used for the routing. You can view code examples in the dark area to the right, and you can switch the programming language oto javascript with the tabs in the top right.

    Development

    This application was built with node and express as the router.

    Installation

    Authentication

    The WEConnect API uses a login criteria (username and password) to log in and provide acces to routes that require authentication and permission(protected routes). The Api is designed to create a session once logged in. This is possible due to the token generated to secure user sign details. upon failure of generating this token, the user is regarded as unauthorized and as such no privileges are granted for the user to acces authenticated/protected routes.

    API requests

    API endpoints and functions

    Type of request route(endpoint) Description
    POST api/v1/auth/signup create a new user
    POST api/v1/auth/signin login existing user
    POST /api/v1/businesses create a new business
    GET /api/v1/businesses get all businesses
    DELETE /api/v1/businesses/:businessId delete a particular business
    GET /api/v1/businesses/:businessId to retrieve a particular business using its businessId
    PUT /api/v1/business/:businessId to update a particular business using its businessId
    POST /api/v1/business/:businessId/reviews to post a review for a given business using its businessId
    GET /api/v1/business/:businessId/reviews to get reviews of a particular business using its businessId
    GET /api/v1/businesses?location=keyword get businesses based on key word (serach query)
    GET /api/v1/businesses?category=keyword get businesses based on key word (serach query).

    Users

    sign Up a User

    request

    Response

    
    request:
    
    {
      "userId": 1,
      "fullname": "pascal pascal",
      "username": "pascal11",
      "password": "passpass",
      "email": "pas@cal.com"
    },
    
    
    
    response:
    
    {
      "message": "user registered successfully",
      "token": "jhgjjgvghccrt4765r876tyuutuytdy65476lkn_kjbjhbhuyh.ghgcvhgcgchgfcfghfcgfdteMNhkjbkhj.hjVBzgdxgfdsjgfgf574xcgfxgd"
    }
    
    

    sign in a User

    request

    Response

    
    request:
    
    {
      "username": "pascal11",
      "password": "passpass",
    },
    
    
    
    response:
    
    {
      "message": "user signed in successfully",
      "token": "jhgjjgvghccrt4765r876tyuutuytdy65476lkn_kjbjhbhuyh.ghgcvhgcgchgfcfghfcgfdteMNhkjbkhj.hjVBzgdxgfdsjgfgf574xcgfxgd"
    }
    
    

    Businesses

    Get All Businesses

    request

    Response

    response:
    
    "status": "success",
    "Businesses":[{
      "id": "1",
      "name": "andela",
      "mage": "andela.jpg",
      "description": "a software development company changing the face of africa",
      "category": "ICT",
      "locatio": "lagos",
      "email": "andela@andela.com",
    },
    {
      "id": "2",
      "name": "irokotv",
      "image": "oroko.jpg",
      "description": "online and offline entertainment business",
      "category": "entertainment",
      "location": "portharcourt",
      "email": "iroko@iroko.com",
    },
    {
      "id": "3",
      "name": "farm crowdy",
      "image": "farmcrowdy.jpg",
      "description": "connects farm owners with investors on farm produce to share profits",
      "category": "farming",
      "location": "kaduna",
      "email": "farmcrowdy@farmcrowdy.com",
    }
    ];
    
    

    Get One Business

    request

    Response

    
    response:
    
    "status": "success",
    "Business":[{
       "id": "2",
      "name": "irokotv",
      "image": "oroko.jpg",
      "description": "online and offline entertainment business",
      "category": "entertainment",
      "location": "portharcourt",
      "email": "iroko@iroko.com",
    },
     ];
    

    Post a new Business

    request

    Response

    
    request:
    
    {
       "id": "2",
      "name": "phazecloud.ng",
      "image": "phazecloud.jpg",
      "description": "home automations business",
      "category": "technology/ICT",
      "location": "abuja",
      "email": "phaze@cloud.com",
    },
    
    

    
    response:
    
    {
    "message":"businesses successfully registered"
    {
       "id": "2",
      "name": "phazecloud.ng",
      "image": "phazecloud.jpg",
      "description": "home automations business",
      "category": "technology/ICT",
      "location": "abuja",
      "email": "phaze@cloud.com",
      }
    }
    
    

    Delete a new Business

    request

    Response

    
    response:
    
    {
       "Message":"Business succesfully deleted"
    },
    
    

    ##Edit a Business

    request

    Response

    
    request:
    
    {
      {"message":"you have successfully updated the business"
       "id": "2",
      "name": "phazecloud.ng",
      "image": "phazecloud.jpg",
      "description": "home automations business",
      "category": "technology/ICT",
      "location": "abuja",
      "email": "phaze@cloud.com",
     }
    }
    
    

    Get all businesses Using a key word(search query=location)

    request

    Response

    
    response:
    
    {
       "id": "2",
      "name": "phazecloud.ng",
      "image": "phazecloud.jpg",
      "description": "home automations business",
      "category": "technology/ICT",
      "location": "abuja",
      "email": "phaze@cloud.com",
    },
    
    

    Reviews

    Post a new review to a Business

    request

    Response

    
    request:
    
    
       {
      "id": 4,
       "review": "truly built on excellence",
    }
    
    response:
    
    {
    "message":"businesses review successfully added"
       {
      "id": 4,
      "reviewedBy": "pascal",
      "review": "truly built on excellence",
    }
    }
    

    Get All Reviews for a given business

    request

    Response

    response:
    
    "status": "successful",
    "Business": "andela nigeria"
     "reviews": [{
      "id": 1,
      "reviewedBy": "clinton",
      "review": "so much verve and gusto!",
    },
    {
      "id": 2,
      "reviewedBy": "longe",
      "review": "so much zeal",
    },
    {
      "id": 3,
      "reviewedBy": "seun",
      "review": "great speed of delivery",
    },
    {
      id: 4,
      "reviewedBy": "pascal",
      "review": "truly built on excellence",
    },
    ]
    
    

    Errors

    Status Code Meaning
    200 Success -- Your request is successful.
    200 created Successfully -- Your post was successful.
    400 Bad Request -- Your request is invalid.
    401 Unauthorized -- Your API key is wrong.
    403 Forbidden -- The kitten requested is hidden for administrators only.
    404 Not Found -- The specified kitten could not be found.
    405 Method Not Allowed -- You tried to access a kitten with an invalid method.
    406 Not Acceptable -- You requested a format that isn't json.
    410 Gone -- The kitten requested has been removed from our servers.
    418 I'm a teapot.
    429 Too Many Requests -- You're requesting too many kittens! Slow down!
    500 Internal Server Error -- We had a problem with our server. Try again later.
    503 Service Unavailable -- We're temporarily offline for maintenance. Please try again later.