Skip to content

TheCodeRaccoons/FlowerShop_API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FlowerShop_API

documentacion del api para el app para florerias

This project's source and others from the org. can be downloaded from https://github.com/TheCodeRaccoons/


Author & Contributor List

  • Jorge Cortez (JorchC)

Sections:


User endpoints


Login using Username/Password

GET: https://appfloreria.herokuapp.com/api/v1/user/login


Example AJAX Call

 $.ajax({
    type: 'GET',
    url: 'https://appfloreria.herokuapp.com/api/v1/user/login',            
    headers: {
        'Content-Type': 'application/json',
    },
    dataType: "JSON", 
    async: false,data: JSON.stringify( {
        "user_name":$('#user_name').val(),
        "password": $('#password').val(), 
    }), 
    success: function(data){
        console.log(data)
    },            
    error: function (errMsg) {
        console.log(errMsg)
    }
});

Get All Users

GET: https://appfloreria.herokuapp.com/api/v1/users/


Example AJAX Call

 $.ajax({
    type: 'GET',
    url: 'https://appfloreria.herokuapp.com/api/v1/user/',            
    headers: {
        'Content-Type': 'application/json',
    },
    dataType: "JSON", 
    async: false,
    success: function(data){
        console.log(data)
    },            
    error: function (errMsg) {
        console.log(errMsg)
    }
});

Get a Single user by ID

GET: https://appfloreria.herokuapp.com/api/v1/user/{userid}/

PARAMETERS:

  • userid

Example AJAX Call:

 $.ajax({
    type: 'GET',
    url: 'https://appfloreria.herokuapp.com/api/v1/user/{userid}/',            
    headers: {
        'Content-Type': 'application/json',
    },
    dataType: "JSON", 
    async: false,
    success: function(data){
        console.log(data)
    },            
    error: function (errMsg) {
        console.log(errMsg)
    }
});

Create a new User

POST: https://appfloreria.herokuapp.com/api/v1/user/

PARAMETERS:

  • user_name
  • password
  • first_name
  • last_name
  • email
  • address
  • phone

Example AJAX Call

 $.ajax({
    type: 'POST',
    url: 'https://appfloreria.herokuapp.com/api/v1/user/',            
    headers: {
        'Content-Type': 'application/json',
    },
    dataType: "JSON", 
    async: false, 
    data: JSON.stringify( {
        "user_name":$('#user_name').val(),
        "password": $('#password').val(),
        "first_name": $('#first_name').val(),
        "last_name": $('#last_name').val(), 
        "email": $('#email').val(), 
        "address": $('#address').val(),
        "phone": $('#phone').val()
    }), 
    success: function(data){
        console.log(data)
    },            
    error: function (errMsg) {
        console.log(errMsg)
    }
});

Delete a User by ID

DELETE: https://appfloreria.herokuapp.com/api/v1/user/{userid}/

PARAMETERS:

  • userid

Example AJAX Call:

 $.ajax({
    type: 'DELETE',
    url: 'https://appfloreria.herokuapp.com/api/v1/user/{userid}/',            
    headers: {
        'Content-Type': 'application/json',
    },
    dataType: "JSON", 
    async: false,
    success: function(data){
        console.log(data)
    },            
    error: function (errMsg) {
        console.log(errMsg)
    }
});

Update a User by ID

PUT: https://appfloreria.herokuapp.com/api/v1/user/{userid}/

PARAMETERS:

  • userid

Data:

  • user_name
  • password
  • first_name
  • last_name
  • email
  • address
  • phone

Example AJAX Call:

 $.ajax({
    type: 'PUT',
    url: 'https://appfloreria.herokuapp.com/api/v1/user/{userid}/',            
    headers: {
        'Content-Type': 'application/json',
    },
    dataType: "JSON", 
    async: false,
    data: JSON.stringify({
        "user_name":$('#user_name').val(),
        "password": $('#password').val(),
        "first_name": $('#first_name').val(),
        "last_name": $('#last_name').val(), 
        "email": $('#email').val(), 
        "address": $('#address').val(),
        "phone": $('#phone').val()
    }), 
    success: function(data){
        console.log(data)
    },            
    error: function (errMsg) {
        console.log(errMsg)
    }
});

Store endpoints


Create a new Store

It is not necesary to store all the data right away but username/password Must be added, the resto of the data can be modified later depending on the admin's need
POST: https://appfloreria.herokuapp.com/api/v1/store/

PARAMETERS:

  • user_name (Store)
  • password (Store)

Example AJAX Call

 $.ajax({
    type: 'POST',
    url: 'https://appfloreria.herokuapp.com/api/v1/store/',            
    headers: {
        'Content-Type': 'application/json',
    },
    dataType: "JSON", 
    async: false, 
    data: JSON.stringify( {
        "store_name": "",
        "admin_user": $('#admin_user').val(),
        "admin_password": $('#admin_password').val(), 
        "store_address":"", 
        "store_zip_code": "", 
        "store_phone":"", 
        "store_email":"", 
        "store_description":"",
        "store_raiting": "", 
        "store_logo": "" , 
        "store_representative" : "",
        "store_social":{
            "store_web": "",
            "store_facebook": "",
            "store_instagram": ""
        },
        "store_sections":{
            "about":{ 
                "banner": "",
                "title": ""
                },
            "catalog":{ 
                "banner": "",
                "title": ""
            },
            "promotions":{
                "banner": "",
                "title": ""},
            "share":{ }
        },
        "store_categories":[],
        "store_promos":[],
        "products":[] 
    }), 
    success: function(data){
        console.log(data)
    },            
    error: function (errMsg) {
        console.log(errMsg)
    }
});

Get All Stores

GET: https://appfloreria.herokuapp.com/api/v1/stores/


Example AJAX Call

 $.ajax({
    type: 'GET',
    url: 'https://appfloreria.herokuapp.com/api/v1/stores/',            
    headers: {
        'Content-Type': 'application/json',
    },
    dataType: "JSON", 
    async: false,
    success: function(data){
        console.log(data)
    },            
    error: function (errMsg) {
        console.log(errMsg)
    }
});

Get single Store by id

GET: https://appfloreria.herokuapp.com/api/v1/store/{storeId}
PARAMETERS:

  • storeId

Example AJAX Call

 $.ajax({
    type: 'GET',
    url: 'https://appfloreria.herokuapp.com/api/v1/store/{storeId}',            
    headers: {
        'Content-Type': 'application/json',
    },
    dataType: "JSON", 
    async: false,
    success: function(data){
        console.log(data)
    },            
    error: function (errMsg) {
        console.log(errMsg)
    }
});

Update single Store by id

PUT: https://appfloreria.herokuapp.com/api/v1/store/{storeId}
PARAMETERS:

  • storeId

Recommended: Since this methos can update every aspect of the store you will need to have previously gathered the
data from the Get Stores or have the data retrived from the login (Which ever is the case) and make the modifications directly on it.

Ex:
StoreData = Data Retrived from the login/get request Then:
StoreData.StoreName = "My Store's name"

Check the Json Schemas for info about the data


Example AJAX Call:

 $.ajax({
    type: 'PUT',
    url: 'https://appfloreria.herokuapp.com/api/v1/store/{storeId}',            
    headers: {
        'Content-Type': 'application/json',
    },
    dataType: "JSON", 
    async: false,
    data: JSON.stringify({ **StoreData** }), 
    success: function(data){
        console.log(data)
    },            
    error: function (errMsg) {
        console.log(errMsg)
    }
});

Delete a Store by ID

DELETE: https://appfloreria.herokuapp.com/api/v1/store/{storeId}

PARAMETERS:

  • storeId

Example AJAX Call:

 $.ajax({
    type: 'DELETE',
    url: 'https://appfloreria.herokuapp.com/api/v1/store/{storeId}',            
    headers: {
        'Content-Type': 'application/json',
    },
    dataType: "JSON", 
    async: false,
    success: function(data){
        console.log(data)
    },            
    error: function (errMsg) {
        console.log(errMsg)
    }
});

Admin endpoints


Login for Admin using Username/Password

GET: https://appfloreria.herokuapp.com/api/v1/admin/login


Example AJAX Call

 $.ajax({
    type: 'GET',
    url: 'https://appfloreria.herokuapp.com/api/v1/admin/login',            
    headers: {
        'Content-Type': 'application/json',
    },
    dataType: "JSON", 
    async: false,data: JSON.stringify( {
        "admin_user" :$('#admin_user').val(),
        "admin_password": $('#admin_password').val(), 
    }), 
    success: function(data){
        console.log(data)
    },            
    error: function (errMsg) {
        console.log(errMsg)
    }
});

Create a new Admin User

POST: https://appfloreria.herokuapp.com/api/v1/admin

PARAMETERS:

  • admin_user
  • admin_password

Example AJAX Call

 $.ajax({
    type: 'POST',
    url: 'https://appfloreria.herokuapp.com/api/v1/admin',            
    headers: {
        'Content-Type': 'application/json',
    },
    dataType: "JSON", 
    async: false, 
    data: JSON.stringify( {
        "admin_user" :$('#admin_user').val(),
        "admin_password": $('#admin_password').val(), 
    }), 
    success: function(data){
        console.log(data)
    },            
    error: function (errMsg) {
        console.log(errMsg)
    }
});

Update an Admin's password by ID

PUT: https://appfloreria.herokuapp.com/api/v1/admin/update/{adminId}

PARAMETERS:

  • adminId

Data:

  • admin_password

Example AJAX Call:

 $.ajax({
    type: 'PUT',
    url: 'https://appfloreria.herokuapp.com/api/v1/admin/update/{adminId}',            
    headers: {
        'Content-Type': 'application/json',
    },
    dataType: "JSON", 
    async: false,
    data: JSON.stringify({
        "admin_password": $('#admin_password').val()
    }), 
    success: function(data){
        console.log(data)
    },            
    error: function (errMsg) {
        console.log(errMsg)
    }
});

Json Schemas in the Database

This Schemas are intended to learn how our Database works, and is only for informational purposes, in here we list the 3 main (Hopefully the noly 3) Schemas for the API where we will store the data, any changes will be listed in here. schema defined down here:

User Schema

    "user":{
        "_id":"",
        "user_name":"",
        "password":"",
        "first_name":"",
        "last_name":"",
        "email":"",
        "address":"",
        "phone":""
    } 

Store Schema

    {
        "_id":"",
        "store_name":"",
        "admin_user":"",
        "admin_password":"", 
        "store_address":"", 
        "store_zip_code":"", 
        "store_phone":"", 
        "store_email":"", 
        "store_description":"",
        "store_raiting":"", 
        "store_logo":"", 
        "store_social":{
            "store_facebook":"",
            "store_instagram":""
        },
        "store_sections":{
            "about":{
                "banner":"",
                "title":""
            },
            "catalog":{
                "banner":"",
                "title":""
            },
            "promotions":{
                "banner":"",
                "title":""
            },
            "share":{
                "banner":"",
                "title":""
            }
        },
        "store_categories":[
            {
                "category_name":"",
                "category_icon":""
            }
        ],
        "store_promos":[{
            "promo_id":"",
            "promo_description":"",
            "promo_amount": 0,
            "promo_banner":""
        }],
        "products":[
            {
            "product_sku":"",
            "product_name":"",
            "product_category":"",
            "product_price":0,
            "product_description":"",
            "product_image":""
            }
        ]
    } 

Ticket schema

    {
        "_id":"",
        "user_id":"",
        "ticket_info":[{
            "store_id":"",
            "store_name":"",
            "product_id":"",
            "product_name":"",
            "price":0
        }],
        "ticket_total":0
    } 

Admin schema

{ 
    "_id":"",
    "admin_user" : "",
    "admin_password" : ""
}

About

documentacion del api para el app para florerias

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published