Documentation of Bit68 (city temperature app)

About

This project is for testing my skills in RESTFul API with Laravel . City Temperature is a RESTful API Project with 3 APIs for client side to help to get city temperature in °C

To Run

You will need:

Setup / configuration

  1. clone Repo
    • git clone https://github.com/Eslam-Ayman/bit68-city-temperature.git
    • cd into your project
  2. Install Composer Dependencies
    • composer install
  3. Create a copy of your .env file
    • cp .env.example .env
  4. Generate an app encryption key
    • php artisan key:generate
    • If the application key is not set, your user sessions and other encrypted data will not be secure!
  5. Create an empty database for our application
  6. In the .env file, add database information to allow Laravel to connect to the database
  7. Migrate the database
    • php artisian migrate
    • if you don't need to migrate so import city_temperature.sql in your DB
  8. you have to install node.js modules:
    • npm install
    • npm run dev
  9. run this command php artisan serve
  10. import postman collection file city-temperature.postman_collection.json

Start using API

Name Method URL Header Body ( RAW ) not (form-data)
Login POST http://127.0.0.1:8000/api/auth/login Content-Type: application/json
Accept: application/json
Required Data: (email, password)
Optional Data: (null)
Register POST http://127.0.0.1:8000/api/auth/register Content-Type: application/json
Accept: application/json
Required Data: (name, email, password, password_confirmation)
Optional Data: (null)
Area GET http://127.0.0.1:8000/api/city-temperature?city_name=cairo Content-Type: application/json
Accept: application/json
Authorization: Bearer
null

Note: if you want to send data in Body Format (form-data) so you must remove Content-Type from Header

Program's Output

N|Solid

Resources / References

public API about list of countries

Note: the free api that has been used in this project doesn't support all world cities so check availabe city from here https://www.metaweather.com/map/

Package used in this project bioudi / laravel-meta-weather-api && guzzlehttp/guzzle

Guzzle is a PHP HTTP client that makes it easy to send HTTP requests and trivial to integrate with web services. to install it using composer composer require guzzlehttp/guzzle

License

GNU GPL License

Author : Eslam Ayman