Configuration Array Of Entities Message

The Connector you develop using the Messaging Framework must be able to parse messages received from the sending API. To parse the message, the Connector must understand the data structure for each message object. You can use a sample message from the sending API to configure the code that parses the inbound message by pasting the sample message as JSON in the item.cs file in your project and modifying the Connector.cs file to match the changes in item.cs. See Creating Message Classes for step-by-step instructions on pasting a message into your project.

If the message received from the third-party API is configured such that the message is an array of entities, note the following: 

In JSON the message might look like:

[{"FirstName""Abby", "LastName""Aaron"},
 {"FirstName""Bobby", "LastName""Burr"}]

The first and last characters are brackets indicating that this is an array.

Pasting that line as JSON to create classes in your project would result in C# code that is a little confusing, so we will break it down. This is what gets pasted, but is not something you want to keep:

public class Rootobject
{
    public Class1[] Property1 { getset; }
}
public class Class1
{
    public string FirstName { getset; }
    public string LastName { getset; }
}

After pasting, there are two generic names, ‘Rootobject’ and ‘Class1’. This feature always creates a single container class, ‘Rootobject’, even though the actual JSON that was pasted was just an array. In this case, you do not need the ‘Rootobject’ class at all, and a clearer name than Class1 is better.

 

It should look exactly like the Configuration Single Entity Message model:

 

public class Person
{
    public string FirstName { getset; }
    public string LastName { getset; }
}

 

You also need to modify the Connector.cs file to recognize the change made in the item.cs file. However, unlike the Configuration Single Entity Message model, the configuration in the Connector.cs would use the RegisterArray method instead and reference Person instead of Class1.

protected override IDictionary<stringMessageDescription> RegisterEntities()
{
    return this.Start.RegisterArray<Person>();
}

See

Building A Messaging Framework Connector