Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

112
Vistas
curl request to guzzle

how convert this curl request

curl request

curl -L -F 'Request={"APIRequests":
[{"Verb":"UploadModelRelease","AuthToken":"","FirstName":"John","LastName":"Smith","Gender
":"0","AgeGroup":"1","Ethnics":"0","Country":"44"}]}' -F
'PropertyRelease=@Documents/jamie.pdf' https://api2.dreamstime.com/api/

to guzzlehttp request

guzzlecode


$client = new \GuzzleHttp\Client();

$response = $client->request('POST', "https://api2.dreamstime.com/api/",[
  'json'=>[
    'APIRequests' => [
            [
              "Verb" => "UploadRelease",
              "AuthToken" => $this->getAccessToken(),//token
              "ModelRelease" => $file,//file path
              "FirstName" => $firstName,
              "LastName" => $lastName,
              "Gender" => $gender,
              "Country" => $country,
              "AgeGroup" => $ageGroup,
              "Ethnics" => $ethnics,
            ],
        ],
  ]
]);

error "please upload a release file"

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

I have written a query closest to the curl request, as curl request has a -F with file that means that it is sending file, you will need multipart. As I have not tested so I can't guarantee that it will work though

/**
 curl -L -F 'Request={"APIRequests":
[{"Verb":"UploadModelRelease","AuthToken":"","FirstName":"John","LastName":"Smith","Gender
":"0","AgeGroup":"1","Ethnics":"0","Country":"44"}]}' -F
'PropertyRelease=@Documents/jamie.pdf' https://api2.dreamstime.com/api/

*/
$client = new \GuzzleHttp\Client();

$response = $client->request('POST', "https://api2.dreamstime.com/api/",[
    'multipart' => [
        [
            'name'     => 'Request',
            'contents' => '{
                            "APIRequests":
                                [{"Verb":"UploadModelRelease","AuthToken":"","FirstName":"John","LastName":"Smith","Gender
                                ":"0","AgeGroup":"1","Ethnics":"0","Country":"44"}]
                            }' // place your json_encode here inplace of above
        ],
        [
            'name'     => 'PropertyRelease',
            'contents' => fopen("/path/to/file", "r")
        ]
    ]
]);
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda