HTTP request using form-data

I have this PHP Code that I want to put into UiPath Request

$values = array(
'order_type' => 2, // 2 dropshipping courier, 3 dropshipping with self pick-up (default is 2)
'client_order_name' => 'Popescu Ion', // 'text' (mandatory)
'client_order_number' => '12647098', // numeric (mandatory)
'message' => 'Your message for seller', // text (optional)
'url_awb' => 'https://www.domain.tld/path/awb.pdf', // url (mandatory)
'products' => [
[
 'sku' => '60969',
 'description' => '', // text (optional)
 'quantity' => 1
]
]
);
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://www.partenerviva.ro/api/orders/new",
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => http_build_query($values),
CURLOPT_HTTPHEADER => array("API-KEY:your-api-key-or-token"),
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HEADER => 0,
CURLOPT_TIMEOUT => 30,
CURLOPT_CONNECTTIMEOUT => 5
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}

I managed to put it into Postman but it's not the best way because it's difficult to use it in UiPath.

![image|690x298](upload://mW7n6wmngOwYC9GXdCdyvny2KU9.png)


I need a way to send the parameter just as **product[]** and the rest in the value, or some way in which I can pass a variable with all other informations.

Any ideas of how I can transport pruduct[0][sku], product[0][quantity], etc. into just one variable products[]?

Hey @Robert_K

Your image is not proper can you please re-upload

And also please share the postman request CURL

Thanks
#nK

@Robert_K , Kindl, Don’t paste images within in quotes. It will not show pictures.

Hello @Robert_K

  1. Download the Uipath.WebAPI.Activities from the manage packages and install it.
  2. Use HTTP request activity and pass your API key.
    image

Kindly refer to this thread, you may get idea

I know how to use APIs, used them a lot.

I don’t know how to put the product Array in the parameter! It’s variable, it could have 3,4,10,100 elements! How can I put that into parameteres because now I put products[0][sku],… products[1][sku]… etc.

It’s not logic I put 100 elements from products[1] to products[100] as parameters and leave them blank… I don’t know even if the server will accept blank posts, or will create blank products…

@Gokul_Jayakumar this was my question

@Robert_K
If it is in a variable, pass API and parameters as a variable in the Properties of the HTTP request.