public static function send_data($key_type, $key_value, $site_url, $user_id, $order) { $obj = NULL; try { $url = wskl_get_host_api_url() . '/logs/sales/'; $body = json_encode(static::create_body($key_type, $key_value, $site_url, $user_id, $order)); $headers = array('content-type' => 'application/json'); $response = Rest_Api_Helper::request($url, 'POST', $body, array(201), $headers); $obj = Sales::from_response($response['body']); } catch (BadResponseException $e) { $e->handle_bad_response(__METHOD__); } return $obj; }