I want an order detail whose po number is xxxx. how to do it via api?
You can try like this :
$userData = array("username" => "admin", "password" => "admin123"); $ch = curl_init("http://magento213/index.php/rest/V1/integration/admin/token"); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($userData)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json", "Content-Length: " . strlen(json_encode($userData)))); $token = curl_exec($ch); $order_number = '1'; $ch = curl_init("http://magento213/index.php/rest/V1/orders/" . $order_number); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json", "Authorization: Bearer " . json_decode($token))); $result = curl_exec($ch); $result = json_decode($result, 1); echo '<pre>';print_r($result);
For More Info Here Is The Reference Link :
https://magento.stackexchange.com/questions/154198/magento-2-how-to-get-order-information-using-rest...
I am glad to see it. check my site save with blogs