AnsweredAssumed Answered

Help needed with SOAP API

Question asked by eroennig eroennig on Jun 17, 2014
I am trying to sent information from my suitecrm to an API. I have received a document explaining which information they accept / need. However, I am not very good at soap and need some help...

Here is an example code that they sent me:

string clientId = "94c546f9-999c-4ceb-969e-8205540b0d6f";
CredentialsDTO credentials = new CredentialsDTO
{ UserName = "xxxxxx", Password = "xxxxxx" };

MonitoringService service = new MonitoringService();

SaveContactsForSiteRequest request = new SaveContactsForSiteRequest();
request.ClientId = clientId;

string contactId1 = "cea00a98-ed08-4289-923d-b29642dfe799";
string contactId2 = "cb4fad73-4ac2-4b40-b2a0-861888a9b328";
string contactId3 = "be100118-2356-4911-b2cf-8ede7ab9d28c";
string contactId4 = "485790fa-668d-4cad-b61c-9d59f89e2d3e";

List contactDetails = new List();
contactDetails.Add(new ContactDetailDTO
{
ClientId = contactId1,
ContactDetail = "(999) 736-9900",
ContactDetailType = "Cell",
FirstName = "Jason",
LastName = "Last",
ContactClientId = clientId
});

contactDetails.Add(new ContactDetailDTO
{
ClientId = contactId2,
ContactDetail = "(999) 723-2057",
ContactDetailType = "Home",
FirstName = "Louise",
LastName = "Last",
ContactClientId = clientId
});
contactDetails.Add(new ContactDetailDTO
{
ClientId = contactId3,
ContactDetail = "(999) 730-6887",
ContactDetailType = "Cell",
FirstName = "Louise",
LastName = "Last",
ContactClientId = clientId
});
contactDetails.Add(new ContactDetailDTO
{
ClientId = contactId4,
ContactDetail = "(999) 723-8073",
ContactDetailType = "Work",
FirstName = "Norman",
LastName = "Last",
ContactClientId = clientId
});

List contactInfo = new List();
contactInfo.Add(new ContactInfoDTO
{
ClientId = contactId1,
ContactDetails = contactDetails.GetRange(0, 1),
FirstName = "Jason",
LastName = "Last",
IsECVContact = true
});
contactInfo.Add(new ContactInfoDTO
{
ClientId = contactId2,
ContactDetails = contactDetails.GetRange(1, 1),
FirstName = "Louise",
LastName = "Last",
IsECVContact = true
});

contactInfo.Add(new ContactInfoDTO
{
ClientId = contactId3,
ContactDetails = contactDetails.GetRange(2, 1),
FirstName = "Louise",
LastName = "Last",
IsECVContact = false
});

contactInfo.Add(new ContactInfoDTO
{
ClientId = contactId4,
ContactDetails = contactDetails.GetRange(3, 1),
FirstName = "Norman",
LastName = "Last",
IsECVContact = false
});

SaveContactsForSiteRequest request2 = new SaveContactsForSiteRequest
{
ClientId = clientId,
ContactsInfo = contactInfo,
Credentials = credentials,
SiteNumber = 400130282,
SystemNumber = 400133328,
ReplaceContacts = true
};

SaveContactsForSiteResponse response = service.SaveContactsForSite(request);

any help would be very appreciated.

Regards

Outcomes