Skip to content

shubham16g/laravel-wallpaper-api

Repository files navigation

Installation:

  • Clone this repository and to load required dependencies run
composer install
  • Create your own .env with the help of .env.example

  • In .env provide your db configration and also add a new API_KEY and ADMIN_KEY. You can replace these with any random string which is used to authenticate your REST API requests.

API_KEY=YOUR_API_KEY

ADMIN_KEY=YOUR_ADMIN_KEY
  • Now Run
php artisan config:cache
php artisan migrate
  • Your server is ready to serve
php artisan serve

REST API Documentation:

Base URL:

http://127.0.0.1:8000/api/

Global Headers:

Accept: application/json
Authorization: Bearer <YOUR_API_KEY or YOUR_ADMIN_KEY>

NOTE: In Authorization header, pass either YOUR_API_KEY or YOUR_ADMIN_KEY. With YOUR_API_KEY, you can only access to Users Endpoints but with YOUR_ADMIN_KEY, you can access all the Requests, Admin and User Endpoints. It is recommanded to put only YOUR_API_KEY in your user's App.

User Routes:

For Wallpapers:

GET wall/
GET wall/?page=2
GET wall/?s=bikes
GET wall/?category=nature
GET wall/?color=red

GET wall/?order_by=downloads
GET wall/?order_by=newest

GET wall/download/{id}

POST wall/list/
Content-Type: application/json

{
	"list": [
		23,
		24,
		33,
		142,
		45,
		60
	]
}

For Categories and Colors:

GET list/category
GET list/color
GET init

For Base Data:

GET base/

Admin Routes:

For Wallpapers:

DELETE wall/{id}

POST wall/
Content-Type: application/json

{
    "source": "https://images.unsplash.com/image-web-page-url",
    "color": "#0099ff",
    "urls": {
        "full":"https://images.unsplash.com/photo-high-quality-url",
        "small":"https://images.unsplash.com/photo-low-quality-url",
        "raw":"https://images.unsplash.com/photo-max-quality-url-OPTIONAL",
        "regular":"https://images.unsplash.com/photo-average-quality-url-OPTIONAL"
    },
    "categories": [
        "nature",
        "amoled"
    ],
    "colors": [
        "blue",
        "white"
    ],
    "tags": [
        "nature",
        "sky",
        "valley",
        "peak"
    ],
    "author": {
        "user_name": "@mogli",
        "name": "Mogli",
        "url": "https://images.unsplash.com/@mogli-OPTIONAL",
        "image": "https://images.unsplash.com/mogli-image-OPTIONAL"
    },
    "rotation": 90,
    "flip": v,
    "license": "CC0-OPTIONAL"
}

POST wall/validate
Content-Type: application/json
{
    "sources": [
        "https://images.unsplash.com/image-web-page-url",
        "https://images.unsplash.com/image-web-page-url2"
    ]
}

Response:
[
    true,
    false
]

For Categories and Colors:

POST add/category
Content-Type: application/json

{
    "name": "Nature",
    "image": "https://images.unsplash.com/photo-low-quality-url"
}

POST add/color
Content-Type: application/json

{
    "name": "Blue",
    "value": "#0099ff"
}

To Update Base Data:

POST base/
Content-Type: application/json

{
    "featured": 23,
    "featured_title": "Wallpaper of the Day",
    "featured_description": "Gave you a nice view of the sky",
    "current_version": 2,
    "immidiate_update": 1,
	"play_store_url_short": "https://bit.ly/yourshorturl"
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published