Quantcast
Channel: Topliners : All Content - All Communities
Viewing all articles
Browse latest Browse all 3423

Image upload using REST API in PHP

$
0
0

Has anyone had any success with uploading images through the Eloqua Rest API using PHP?

 

I have the end point, but i can't figure out what information needs to go in to the $data variable.

 

This is what i currently have:

 

<?php

ini_set('display_errors', 1);

include("../../eloquaRequest.php");

$eloquaRequest = new EloquaRequest('Instancename', 'username', 'password', 'https://secure.eloqua.com/API/REST/1.0');

$data = new stdClass();

$data->image = file_get_contents("./easy.jpg");

$data->name = "This is a filename";

$data->filename= "luke.jpg";

$data->contentType = "image/jpeg";

$response = $eloquaRequest->post('assets/image/content', $data);

var_dump($response);

 

The error i am getting is the following but i think this is a standard response if your image does not go through correctly:

 

array(1) { [0]=> object(stdClass)#3 (2) { ["type"]=> string(9) "FileError" ["requirement"]=> object(stdClass)#4 (3) { ["type"]=> string(15) "SizeRequirement" ["maxSize"]=> int(52428800) ["minSize"]=> int(1) } } }

 

Thanks


Viewing all articles
Browse latest Browse all 3423

Trending Articles