简体   繁体   中英

Eloqua integration via REST API using JAVA

Contact standard fields like First Name, Last Name and Email Address have been set via java and integrated using Rest API.

  • Could you please guide me in creating custom objects and custom fields via java using REST API?
  • I can create the same in .NET how to do the same in java?

.NET code is below:

var customObject = new CustomObject
{
    id = -10001,
    name = "Disruption",
    fields = new List<CustomObjectField>
    {
        new CustomObjectField
        {
            name = "FlightNumber",
            dataType = Enum.GetName(typeof(DataType), DataType.text),
            type = "CustomObjectField"
        },
        new CustomObjectField
        {
            name = "FlightDate",
            dataType = Enum.GetName(typeof(DataType), DataType.text),
            type = "CustomObjectField"
        },
        new CustomObjectField
        {
            name = "DisruptionType",
            dataType = Enum.GetName(typeof(DataType), DataType.text),
            type = "CustomObjectField"
        },
        new CustomObjectField
        {
            name = "EmailAddress",
            dataType = Enum.GetName(typeof(DataType), DataType.text),
            type = "CustomObjectField"
        }
    }
};

Just create a class representing your data with Java (using ArrayList for JSON arrays):

For your field:

public class customObjectField {
private String FlightNumber;
private String FlightDate;
...
}

For your object:

public class customObject {
private int id;
private String name;
private arrayList<customObjectField> fields;
}

Instantiate then serialize with gson. Then post the String.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM