PIZZAPI With Slim Framework 3
Example of ajax with JavasCript
$.ajax({
url:"http://pizzapi.esy.es/services/user/signup",
dataType: 'jsonp',
data: { name: 'David',
address: 'Palmas',
zipCode: '24010',
phone: '6462236390',
email: 'dguilessn@arkusnexus.com',
gender: 'M',
user: 'gulsn', password:'12348'},
success:function(json){
console.log(json);
},
error:function(){
alert("Error");
}
});
url: Path of the section for request.
dataType: Jsonp (For CrossCityRequest).
data: Parameter for the request.
Status: fail/done
code: the code indicate what was happend
msg: Message of the process
array: When the api request its a get
code number |
mesage |
'code'=>'10' |
create account |
'code'=>'11' |
internal error |
'code'=>'12' |
missings fields |
'code'=>'13' |
This user already exists |
'code'=>'14' |
This email already exists. |
'code'=>'15' |
Login successfully |
'code'=>'16' |
Bad Login |
'code'=>'17' |
update successfully |
'code'=>'18' |
bad update |
'code'=>19 |
Exists Products and Sizes |
'code'=>20 |
something Goes bad or no exist that category |
'code'=>'21' |
Order Created successfully |
http://pizzapi.esy.es/services/SECTION/METHOD
It's needed send the data with the name how its indicate in this readme.
PATH |
DATA REQUIRED |
DATA RETURNED |
user/signup |
name, address, zipCode, phone, email, gender, user, password |
'code'=>'10' , 'code'=>'11' , 'code'=>'12', 'code'=>'13' , 'code'=>'14' |
user/login |
user, password |
'code'=>'15' , 'code'=>'16', array(user, id) |
user/update |
name, address, zipCode, phone, email, gender, user, password |
'code'=>'17', 'code'=>'18' |
products/getProducts |
category |
'code'=>'19' 'products'=>array( array() ),'size'=>array( array() ), 'code'=>'20', 'code'=>'12' |
products/makeOrder |
order_date, customer_id, total_price, order_distance, product_id, quantity, description |
'code'=>'21', 'code'=>'20' , 'code'=>'12' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|