Commonly used API
Introduce
Commonly used APIs from the goeasyapp system
Add Cart
POST /add/cart
Parameters:
- data (array): Array of cart items, each with fields:
id, name, image, quantity, type, price, sale, color, size, option
- note (object): { note, gift_wrap, country, zipCode }
- plus (object): { gift_wrap, ship }
Response:
- success (boolean)
- message (string)
- cart (object): Updated cart details
$.ajax({
type: "POST",
url: "https://clinicmaster.goeasyapp.com/add/carts",
contentType: "application/json",
dataType: "json",
headers: { 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') },
data: JSON.stringify({
data: [{
id: item.attr('data-id'),
name: item.attr('data-name'),
image: item.attr('data-image'),
quantity: item.attr('data-quantity'),
type: item.attr('data-type'),
price: item.attr('data-price'),
sale: item.attr('data-sale'),
color: item.attr('data-color'),
size: item.attr('data-size'),
option: item.attr('data-option')
}],
note: {
note: $('#shoppingCart #Cart-note').val(),
gift_wrap: $('.add-gift input.gift_wrap').val(),
country: $('#shoppingCart .get-country').val(),
zipCode: $('#shoppingCart .get-zip').val()
},
plus: {
gift_wrap: $('.add-gift input.gift_wrap').val(),
ship: ship
}
}),
success: function(response) {
// handle response
}
});
Delete Cart
POST /delete/cart
Parameters:
- id (int): Cart item ID to remove
Response:
- success (boolean)
- message (string)
- cart (object): Updated cart details
$.ajax({
type: "POST",
url: "https://clinicmaster.goeasyapp.com/delete/cart",
contentType: "application/json",
dataType: "json",
headers: { 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') },
data: JSON.stringify({ id: id }),
success: function(response) {
// handle response
}
});
Add Favourite
POST /add/favorite
Parameters:
- id (int): Product ID to add to favorites
Response:
- success (boolean)
- message (string)
$.ajax({
type: "POST",
url: "https://clinicmaster.goeasyapp.com/add/favorite",
contentType: "application/json",
dataType: "json",
headers: { 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') },
data: JSON.stringify({ id: id }),
success: function(response) {
// handle response
}
});
Delete Favourite
POST /delete/favorite
Parameters:
- id (int): Favorite item ID to remove
Response:
- success (boolean)
- message (string)
$.ajax({
type: "POST",
url: "https://clinicmaster.goeasyapp.com/delete/favorite",
contentType: "application/json",
dataType: "json",
headers: { 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') },
data: JSON.stringify({ id: id }),
success: function(response) {
// handle response
}
});
Add Comment
POST /add/comment
Parameters:
- id (int): Item ID to comment on
- email (string)
- comment (string)
- composer (string)
- author (string)
- rate (int)
Response:
- success (boolean)
- message (string)
$.ajax({
type: "POST",
url: "https://clinicmaster.goeasyapp.com/add/comment",
contentType: "application/json",
dataType: "json",
headers: { 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') },
data: JSON.stringify({
id: item.attr('data-id'),
email: email,
comment: comment,
composer: item.attr('data-composer'),
author: name,
rate: rate
}),
success: function(response) {
// handle response
}
});
Save Data to Composer (e.g. Subscribe, Contact)
POST /system/composer/{slug_composer}/update
Parameters:
- type_save (string): 'ajax' (default)
- Other fields depend on composer setup, e.g.:
name, email, phone, ...
Response:
- success (boolean)
- message (string)
$.ajax({
type: "POST",
url: "https://clinicmaster.goeasyapp.com/system/composer/subscribe/update",
contentType: "application/json",
dataType: "json",
headers: { 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') },
data: JSON.stringify({
type_save: 'ajax',
name: 'John Doe',
email: 'john.doe@example.com',
// other composer fields
}),
success: function(response) {
// handle response
}
});
Note
1. Method: POST
2. URL: {{ __routeUrl('/') }}system/composer/{{slug_composer}}/update
3. Default param: type_save = 'ajax'
4. Other fields depend on composer structure
5. Do not send 'id' param when creating new data