0% found this document useful (0 votes)
12 views3 pages

Washing Module API

Uploaded by

v i k k i
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views3 pages

Washing Module API

Uploaded by

v i k k i
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

05/12/2024 10:30AM

POST | http://192.168.1.4/unit61/index.php/Apiv4/create_new_records

INPUT: Key value


kanban_no | 9011345
dispatch_area | washing
quantity | 500
added_by | 4456
// create new record
public function create_new_records() {

$new_data = $this->input->post();

if (empty($new_data)) {
echo json_encode(['status' => 'error', 'message' => 'Invalid or missing
data.']);
return;
}

$sanitized_data = $this->security->xss_clean($new_data);

$this->load->database();

try {
$this->db->insert('eol_dispatch_master', $sanitized_data);

if ($this->db->affected_rows() > 0) {
echo json_encode(['status' => 'success', 'message' => 'New record
created successfully.']);
} else {
echo json_encode(['status' => 'error', 'message' => 'Failed to create
new record.']);
}
} catch (Exception $e) {

log_error($e->getMessage());
echo json_encode(['status' => 'error', 'message' => 'An error occurred
while creating the new record.']);
}
}

OUTPUT:
{"status":"success","message":"New record created successfully."}
05/12/2024 10:30AM

POST | http://192.168.1.4/unit61/index.php/Apiv4/get_kanban_details

INPUT: Key value


kb_number |
68006157001128761225

// getting kanban details


public function get_kanban_details()
{
$kb_number = $_POST['kb_number'];

$this->db-
>select('kanban_master.kb_number,kanban_master.po_no,kanban_master.quantity,kanban_
master.size_name,kanban_sets.color,kanban_sets.item_no,kanban_sets.country,purchase
_orders.country,purchase_orders.tot_qty');
$this->db->from('kanban_master');
$this->db->join('kanban_sets', 'kanban_master.set_no = kanban_sets.set_id',
'left');
$this->db->join('purchase_orders', 'kanban_sets.set_id =
purchase_orders.po_id', 'left');
$this->db->where('kanban_master.kb_number', $kb_number);

$data = $this->db->get()->result_array();

if (!empty($data)) {
$response['status'] = true;
$response['message'] = 'Data retrieved successfully';
$response['data'] = $data; // Directly use the joined data
} else {
$response['status'] = false;
$response['message'] = 'No data found';
$response['data'] = [];
}

echo json_encode($response);
}

OUTPUT:
{
"status": true,
"message": "Data retrieved successfully",
"data": [
{
"kb_number": "68006157001128761225",
"po_no": "6800615700",
"quantity": "65",
"size_name":
"{\"S\":\"65\",\"M\":\"\",\"L\":\"\",\"XL\":\"\",\"2XL\":\"\"}",
"color": "DESERT SKY",
"item_no": "703H",
"country": "INDIA",
"tot_qty": "1229"
}
]
}

03/12/2024 16:05
http://192.168.1.4/unit61/index.php/Apiv4/user_login

POST
params :- username
password

{
"status": true,
"message": "Logged in successfully",
"data": {
"su_id": "7",
"full_name": "EOL Auditor",
"username": "eol",
"password": "81dc9bdb52d04dc20036dbd8313ed055",
"role": "staff",
"dept": "5",
"status": "Active",
"updated": "2022-08-27 09:55:46"
}
}

{
"status": false,
"message": "Invalid Username or password"
}

You might also like