Submitting a form Via the REST API using the PHP library request

Can someone send please how to use the library to query PHP found at fredsakr/eloqua-php-request · GitHub to publish form to Eloqua data?

So far, I have following:

// include the Eloqua REST client 
require_once('eloquaRequest.php');  


// define the Contact class  
class ContactForm  
{
  public $FirstName;  
  public $LastName;  
  public $PhoneNumber;
  public $Institution;  
  public $ContactComment;  
  public $EmailAddress; 
} 

$client = new EloquaRequest('SITE', 'USERNAME', 'PASSWORD', 'https://secure.eloqua.com/API/REST/1.0');

// instantiate a new instance of the ContactForm class 
$contact = new ContactForm();  
$contact->FirstName = 'Sample';  
$contact->LastName = 'Import'.date("Y-m-d-H-i-s");  
$contact->PhoneNumber = '111-111-1111';
$contact->Institution = 'Company Name';
$contact->ContactComment = 'This is a test of the API';
$contact->EmailAddress = '[email protected]'; 

// invoke a POST request to create the contact 
$response = $client->post('/data/form/45', $contact);


However, it returns the following:


array(1) { [0]=> object(stdClass)#318 (4) { ["type"]=> string(21) "ObjectValidationError" ["property"]=> string(11) "fieldValues" ["requirement"]=> object(stdClass)#316 (1) { ["type"]=> string(23) "NoDuplicatesRequirement" } ["value"]=> string(6) "" } }


Can someone give me a guide step by step on how to do it properly please?

Hello world

We have added a 'sample' in the repository of PHP library folder request on Github. The first example shows how to submit form using the API data:

Please note that you can describe the form fields and other metadata using the following endpoint:

Hope this helps and please let me know if you need more information.

Thank you

Fred

Tags: Marketers

Similar Questions

  • Enter a list of fields with internalName, via the PHP API

    Using the URL "https://secure.eloqua.com/API/REST/1.0/assets/contact/fields", I can currently get a list of all the fields used for my contacts (IE. Email, phone etc.)

    It works fine, but for some reason any the internalName of each field is not included in the answer; it seems that if I want this value I have to do the initial HTTP request as shown above and then loop separately on each field that results and perform another HTTP request ("https://secure.eloqua.com/API/REST/1.0/assets/contact/field/'.") $item ['id'] ) for each of them.

    Unfortunately, I have more than 200 fields. up to 200 + HTTP requests separate isn't a viable solution.

    Is there anyway that I am perhaps dominant, to a list of contact fields which includes the internalName?

    I'm writing an Eloqua addon for WordPress plugin gravity forms, and this is something which is urgently needed for automatic mapping of the fields in the form of gravity at Eloqua fields.

    Any input or advice is greatly appreciated!

    Best regards

    M.T. Jordan

    Hello world

    A quick update - I found a work around for this as follows:

    (1) runs an initial call to get all forms of Eloqua: /assets/forms? search = *

    (2) present the list form returned to the user admin as a select entry in a form

    (3) using ajax, on select change run a second query (using the selected form id) to return the form object: /assets/form/'.$form_id.'? = full depth

    (4) the above call returns information field, including the internalName, that I can use later for consignments of automated form when a form of gravity is subject

    Thank you once again, Daniel, for your previous answer.

    I wanted to make sure I post my solution here so you don't have to waste time trying to help unnecessarily.

    All the best,

    Mike

  • Question on calls of vChargeBack rest api using PHP

    I try to log in to vCenter using vChargeBack API in PHP. I am having some problems when trying to call the rest service.

    My code

     
    $xmlfile=simplexml_load_file('login.xml'); 
    $ch = curl_init(); 
    curl_setopt($ch, CURLOPT_POST, 1);   
    curl_setopt($ch, CURLOPT_POSTFIELDS,$xmlfile);//Passing XML file as POST field 
    curl_setopt($ch, CURLOPT_TIMEOUT, 10);   
    curl_setopt($ch, CURLOPT_URL,"https://xx.xx.xx.xx/vCenter-CB/api/login"); //Setting URL   
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);   
    curl_setopt($ch , CURLOPT_SSL_VERIFYPEER , false );//Since I am requesting https 
    curl_setopt($ch , CURLOPT_SSL_VERIFYHOST , false );//Since I am requesting https 
    curl_setopt($ch, CURLOPT_HTTPHEADER, array ('Accept: ' . "application/xml" )); 
    $response=curl_exec($ch);//Getting response 
    $responseInfo=curl_getinfo($ch);//Getting response headers
    echo $response;
    print_r($responseInfo);
    
    
    
    
    
    


    I have to pass the request as XML data in the body of the request. And also I have version as an URL parameter (I tried from version by adding? version = 1.5.0 to the URL). My XML file request is

      <?xml version="1.0" encoding="UTF-8"?>
    <Request xmlns="http://www.vmware.com/vcenter/chargeback/1.5.0">
     <Users>
      <User>
      <Type>local</Type>
      <Name>admin</Name>
      <Password>xxxxxxxx</Password>
      </User>
     </Users>
    </Request>


    When I try to run it, I get the status code 400 (Bad Request). Y at - it something I am doing wrong? Please help me out of this problem.

    Kind regards

    Srinath

    Hello Srinath.

    After some research, I was able to make calls from rest of chargeback API using PHP.

    I used this RestClient (full credit to the author):

    http://www.PhpClasses.org/package/5480-PHP-send-Web-services-requests-to-rest-servers.html

    With this class, using the API is quite simple:

    include 'library/RestClient/RestClient.class.php';
    
    $chargeBack = RestClient::post(
                $vCenter_chargebackBaseURL."/login?version=1.0.1",
                ''.
                ''.
                ''.
                'local'.
                ''.$vCenter_chargebackUsername .''.
                ''.$vCenter_chargebackPassword.''.
                ''.
                '',
                null,
                null,
                "application/xml"
                ); 
    
    var_dump($chargeBack->getResponse());
    var_dump($chargeBack->getResponseCode());
    var_dump($chargeBack->getResponseMessage());
    var_dump($chargeBack->getResponseContentType());
    

    Please, note that I had to add this line to the RestClient.class.php file inside the constructor method:

    curl_setopt ($this-> curl, CURLOPT_SSL_VERIFYPEER, false);

    Read this to learn more on this line and alternatives:

    http://unitstep.net/blog/2009/05/05/using-curl-in-PHP-to-access-HTTPS-ssltls-protected-sites/

    I hope this helps.

    Kind regards.

  • serialized Pof form via the BackingMapManagerContext.getValueToInternalC?

    Hello

    If I object cache x with definition of Pof.

    Session x;

    The return from the call to
    BackingMapManagerContext.getValueToInternalConverter () .convert (x);
    will be the same Pof serialized as cache?

    I guess another way to get the serialized PoF is via the call ExternalizableHelper.toBinary (x, ConfigurablePofContext);

    The question is when the code is necessary, it's in the place performs the backup-card operation during a call to entry processor. I don't know where to find the "ConfigurablePofContext" of.

    If BackingMapManagerContext.getValueToInternalConverter () .convert (x) may return the Pof serialized, that will be good enough.

    Thanks in advance for your help.

    Hello

    You should try to use the BackingMapManagerContext.getValueToInternalConverter () .convert (x); When this is possible because this will always be the appropriate serializer. If you use BackingMapManagerContext.getKeyToInternalConverter () to convert the key then this will also ensure the binary is properly decorated, which will not be ExternalizableHelper.

    You can get the PofContext in an EntryProcessor like that...

    public Object process(InvocableMap.Entry entry) {
        PofContext pofContext = (PofContext) ((BinaryEntry)entry).getSerializer();
    
    }
    

    JK

  • Why can't I see the pre-recorded videos of TV via the media library?

    When I open the Windows Media Center on my new Toshiba laptop, that I go as far as to check the recorded TV shows. I can click on the thumbnails, but the videos won't play.
    I get an error message on videos that I tried that says there is a problem viewing this video, please try to view another. None works!

    Windows Media Center has been installed as part of Windows 7 Home premium installed on the computer, Microsoft Silverlight also seems to be installed ok.
    The photos section works perfectly, pulling the info from my photos. You can give me any advice as to what is causing the problem.

    I was using Internet Explorer 9 (32-bit) as a Navigator, but that also gave me problems with Java script if I try to open a video using the Bing search engine. However if I use Mozilla Firefox (now my default browser) or Google Chrome and go to the video player via the MSN Web site I can watch videos without problem.

    I have Flash Player version 10.3,183,5 installed, I also tried version 11 (64-bit of the trial) when using Internet Explorer 64-bit version, but were advised not to use it.

    The laptop has all the right features to run this program.

    Thank you

    Can you please tell us first what model of laptop you have exactly?
    When you use recorded TV tv you can watch the sample movie?

  • External authentication via the PHP script failed

    I'm not a PHP genius - in fact I'm not a backend coder so I'm kinda struggeling with the sample scripts - I still hope for a sample of CF....

    I'm trying to run and connect to the CAA via the command line (Terminal). I'm not sure what I'm doing wrong - this is what I'm passing:
    PHP f /Applications/MAMP/htdocs/afcs.php args - debug - host = my_pass, http://connectnow.acrobat.com, fcguru, my_login

    The username and password I spend are correct. However, I get this response:
    Error: message exception 'AFCSError' with ' < State response 'error' = >
    < error code = "AUTH_FAILED" >
    < msg > failed authorization < / msg >
    < / error >
    < / answer >
    ' in /Applications/MAMP/htdocs/afcs.php:86

    Really struggeling with this. Once again I get this working from the command line, I don't know how to call it from a script instead. I use CF on the backend, no PHP.

    Kind regards

    Stefan

    Thank you, this is very useful. It seems that I can now connect from the Terminal so that's a good start. Also, I did not see external authentication in PHP for example - I must have been blind.
    I'll see how far I get with that. What I'm trying to do is spawn new rooms based on a template on the fly, and I have some doubts, I'll be able to understand this myself.

  • Need help getting A value in My App using xml/php http request

    I know that maybe this isn't the place to ask questions about php, but I thought that people may have encountered a similar problem and I'm getting desperate basically my application's data is stored in a mysql database table, and what I have to do is to get the value of auto increment of this table in my application via an http request. I'm doing a php file that gets this value and displays this value in the xml format, but I'm terrible at creating php to do such things and just get the constant errors. Can someone take a look at this and help me to tweak it so it does what I want it please? The table in question is called links and the line/field/column in the table I'm after is called linkid. This is the next value of auto-increment this line printed in xml format, that's what I want. Here is the php so far:-

    <?php 
    header("Content-type: text/xml"); 
    $host = ""; 
    $user = ""; 
    $pass = ""; 
    $database = ""; 
    $linkID = mysql_connect($host, $user, $pass) or die("Could not connect to host."); 
    mysql_select_db($database, $linkID) or die("Could not find database."); 
    $tablename   = "links";
    $next_increment  = 0;
    $qShowStatus   = "SHOW TABLE STATUS LIKE '$tablename'";
    $qShowStatusResult  = mysql_query($qShowStatus) or die ( "Query failed: " . mysql_error() . "<br/>" . $qShowStatus );
    $row = mysql_fetch_assoc($qShowStatusResult);
    $next_increment = $row['Auto_increment'];
    echo "next increment number: [$next_increment]"; 
    ?>
    

    Hello

    step 1. the customer wants to add a new record. and sends a request for a new record

    step 2. the server adds a new record in the database (now its Blanck) and returns its ID number

    step 3.  the customer has now has an appropriate identification number and use it to add a new object to the table

    step 4. the customer with a registration ID and the new data for this "empty folder" is an update not an insert.

    step 5. You now have the table and database synchronization.

    David.

  • Submitting a form on the test server

    Hi all

    I run a WAMP server on my laptop and so far did not worth setting up a test server. I'm trying now.

    I have a small php/mysql site with a login.

    I raise the index php and it asks me to discover the files so I press Yes. In live mode view, I fill the login form, and then press ENTER. Then I press on enter again. After about 5 steps I realize that the enter key will not work now.

    On my WAMP, it works very well. Present on it checks errors, and if it is not all redirects to a page called loggedin.php

    Should I wait for the button submit to redirect within the window he direct DW?

    (BTW if I bring logeedin.php, discover the files it shows me the login.php file - which is what I expected since no cookie has been set yet)

    Thanks in advance

    Edward

    I normally don't use Live View for test forms. However, for links and buttons to work in Live View mode, you must hold down the CTRL (Cmd on a Mac).

  • Problem of forms via the "submit" button

    I am distributing a PDF via Microsoft Outlook and then compile the answers on my local server.  However, when participants click on 'submit', there is an error in the script that causes Outlook give me this message:

    Doc2.jpg

    Any help is very appreciated!

    J. Klaybor

    Hello

    No problem. Just open the Script Editor in the designer of the LC (if not already open). Window menu or F5.

    Drag to the bottom of the window (if it's only to show a single line), so that you can see several lines.

    Should be good to go! You can then the script against different manifestations, etc.

    Niall

  • Xbox via the media library

    trying to use my xbox 360 through media Center on windows xp media center edition, but could not get the settings to www.xbox.com/pcsetup as suggested on my xbox but I can't find the place where to enter the eight-digit number given on my xbox

    Hello

    When you complete the installation on your computer and that you have received 8-digit code, you can try the steps mentioned below and check if it helps.

    Method 1: Get the key of installation on your console:

    one) on your console, go to applicationsand select My Appsand select Windows Media Center.

    Tip Seeing noApps? You may need to update your Xbox 360 console software.

    (b) click continue.

    (c) Note this 8-digit setup key.


    Method 2: Add your console in Windows Media Center:

    (a) start Windows Media Center on your computer.

    (b) go totasks, and then click add Extender.

    (c) when you are prompted, enter the license key step 3 8-digit.

    (d) clickNext to complete the installation.

    Method 3:  Start Windows Media Center on your console:

    Access theapplications, select My Apps, and then select Windows Media Center.

    It will take time to build your media libraries the first time that you use Windows Media Center on your console.

    You can visit the below mentioned link for more information.

    http://support.Xbox.com/en-us/Xbox-360/audio-video-Setup-and-use/Xbox-360-as-media-player-mcewindows7

    Hope this information is useful.

  • Why can't get a signal tv via the media library when I can get a TV signal perfect through my TV?

    Channel 7 works at the present time through media library, but none of the other channels are. All I get is that the channel may be off the air or I need to reconnect to the antenna... When I Flip on the tv, all channels are fine.

    What the tv tuner card do you have?

    Update the tv tuner card driver and the graphics driver on the manufacturers Web sites. Tv signal reconfigures once done.

  • Uploading images using the REST API from PHP

    Does anyone at - he had success with the download of the images through the Eloqua Rest API using PHP?

    I have the final point, but I can't understand what kind of information needs to go the variable $data.

    That's 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 file name ";

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

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

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

    var_dump ($Response);

    The error I get is the following, but I think that it 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)}}}

    Thank you

    Hi Phil,

    I had to find that it all the time, it took me several hours. I hope that it allows you to save a headache.

    Eloqua is very strict in dealing with the content-type header; See the comment here for a little explanation; REST API - download Images

    So what you need to do in PHP, is to build the query string for the image of yourself. You can do as follows (to adapt to your needs, not yet tested);

    <>

    [...]

    $img_path = '. / easy.jpg';

    $img_info = getimagesize ($img_path);

    $img_real = realpath ($img_path);

    $data = "-ELOQUA_BOUNDARY\r\n".

    ' Content-Disposition: form-data; name =-"Filedata\"; filename =------"".baseName ($img_real). » \"\r\n ».

    "Content-Type: '. '" $img_info ['mime']. "" \r\n ".

    "\r\n".

    file_get_contents() ($img_real). "" \r\n ".

    ' - ELOQUA_BOUNDARY - ';

    $headers = array ("Content-Length:".strlen ($data),"Content-Type: multipart/form-data;") Boundary = ELOQUA_BOUNDARY");

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

    ?>

    I have also adapted/reconstructed library Eloqua PHP in order to support the "BOLD" part. You must change the executeRequest function and add something like this to support change the request headers;

    curl_setopt ($this-> ch, CURLOPT_HTTPHEADER, $headers);

  • How to get assets via the REST API (Webcenter Sites)

    Hello world

    I need to get assets via the REST API using Javascript, but I don't know how to open a session. Can someone explain to me how do?

    I would really appreciate it.

    I also followed this guide Oracle Webcenter REST API permission | Stories of official codification but does not work.

    Best regards!

    Hello rvillamarin,

    Take a look at https://docs.oracle.com/cd/E29542_01/doc.1111/e29634/wemsecurity.htm#WBCSD306. With this, you should be able to get a ticket, to pass at the request of the REST.

    Kind regards

    Stephan.

  • How do to identify the documents called "models of library" using the RESTful API?

    How do to identify the documents called "models of library" using the RESTful API? Furthermore, what constitutes a document to be a "model of library"? I see nothing in the libraryDocuments RESTful documentation that describes this type of document, such as presented on the tab 'Manage' my developer account. Please see the screenshot below. There is a model of Document named "[DEMO ONLY] Test model" listed under "Library Templates" and I try to figure out which classifies that document to be included this way and how does produce a similar announcement by using the RESTful API.

    Screen Shot 2014-10-29 at 11.16.48 AM.png

    Thank you!

    Hello

    You can connect to access library models using the REST API, use 'GET /libraryDocuments' allowing to recover documents in library for a user. Models are created in the account of EchoSign, which later are accessible via the REST method mentioned above.

    Jat

  • Updated filter shared via the REST API

    Hello I'm trying to update a shared API filter. I'm using PHP and client fredsakr/eloqua-php-application · GitHub.

    So far, I was able to retrieve the filter with the following call:

    <?php
    require('./eloquaRequest.php');
    $eloquaRequest = new EloquaRequest('site', 'User.Name', 'password', 'https://secure.eloqua.com/API/REST/1.0');
    $response = $eloquaRequest->get('assets/contact/filters?search=TheFilterName&depth=complete');
    print_r($response);
    ?>
    

    I can see the filter in the answer below:

    (
        [type] => ContactFilter
        [currentStatus] => Active
        [id] => 100761
        [createdAt] => 1380137168
        [createdBy] => 48
        [depth] => complete
        [folderId] => 1036
        [name] => TheFilterName
        [updatedAt] => 1383589417
        [updatedBy] => 48
        [count] => 254382
        [criteria] => Array
            (
                [0] => stdClass Object
                    (
                        [type] => ContactFieldCriterion
                        [id] => 1912
                        [condition] => stdClass Object
                            (
                                [type] => TextSetCondition
                                [operator] => in
                                [optionListId] => 193
                            )
    
                        [fieldId] => 100012
                    )
    
            )
    
        [lastCalculatedAt] => 1380137190
        [scope] => global
      statement] => 1912
    

    What I want to do is update that corresponds to the values of 'Compare the Contact fields' in the GUI Eloqua under Contact = > Shared Library = > Contact filters.

    Looks like he has the "[type] = ContactFieldCriterion" under the [criteria] field in the response.

    I'd get how this value in a call to REST, and also how I would update it.

    Please let me know if you need more details on this issue. Please help and thank you.

    After some research I found what I wanted to do has been updated the list of options for this filter. See http://topliners.eloqua.com/docs/DOC-3588 for documentation on the base object. But I had difficulty in updating an OptionList with the Rest API using PUT. If you can help, please visit http://topliners.eloqua.com/message/36739#36739 . Thank you.

Maybe you are looking for