Returns a contact by its ID.
To specify a project that contains the contact, use the ProjId
value in the AuthenticationData
object in the request body. To search for the contact in several projects, use the ProjIds
value to specify the list of projects IDs in the AuthenticationData
object.
To get several or all the contacts, use Contacts_LoadByCriteria
.
Requirements
The authenticating user must belong to a user group that has the Read privilege for Contacts.
Parameters
The operation uses the following parameters:
AuthenticationData : AuthenticationData, required
An AuthenticationData
object with the login information and the ID of the project (or the list of project IDs) that contains the contact.
ContactId : integer, required
The contact ID.
Result
A Contact
object that contains the contact information.
Example
Sample Code
C#
string login = "[email protected]";
string password = "p@ssword";
int projID = 10372;
// The contact ID
int ID = 4;
ServiceSoapClient service = new ServiceSoapClient();
// Preparing AuthenticationData
LoginInfo loginInfo = service.GetLoginInfo("", login, password);
AuthenticationData authData = new AuthenticationData();
authData.AppCode = loginInfo.AppCode;
authData.UserId = loginInfo.UserId;
authData.PassCode = password;
authData.DeptId = loginInfo.DeptId;
authData.ProjId = projID;
// Loading the contact
Contact contact = service.Contacts_Load(authData, ID);
Console.WriteLine("{0} from {1}: {2}", contact.ContactPerson, contact.CompanyName, contact.Email);
Java
String login = "[email protected]";
String password = "p@ssword";
int projID = 10372;
// The contact ID
int ID = 4;
ServiceSoap service = new Service().getServiceSoap12();
// Preparing AuthenticationData
LoginInfo loginInfo = service.getLoginInfo("", login, password);
AuthenticationData authData = new AuthenticationData();
authData.setAppCode(loginInfo.getAppCode());
authData.setUserId(loginInfo.getUserId());
authData.setPassCode(password);
authData.setDeptId(loginInfo.getDeptId());
authData.setProjId(projID);
// Loading the contact
Contact contact = service.contactsLoad(authData, ID);
System.out.format("%s from %s: %s", contact.getContactPerson(), contact.getCompanyName(), contact.getEmail());
Sample Request XML
POST /psws/psws.asmx HTTP/1.1
Host: myteam.mysite.com
Content-Type: text/xml; charset=utf-8
Content-Length: 494 {Insert an appropriate value here}
SOAPAction: "http://www.pragmaticsw.com/Contacts_Load"
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<Contacts_Load xmlns="http://www.pragmaticsw.com/">
<AuthenticationData>
<AppCode>agSP</AppCode>
<DeptId>7154</DeptId>
<ProjId>1032</ProjId>
<UserId>25315</UserId>
<PassCode>p@ssword</PassCode>
</AuthenticationData>
<ContactId>4</ContactId>
</Contacts_Load>
</soap:Body>
</soap:Envelope>
SOAP 1.2
POST /psws/psws.asmx HTTP/1.1
Host: myteam.mysite.com
Content-Type: application/soap+xml; charset=utf-8
Content-Length: 502 {Insert an appropriate value here}
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<Contacts_Load xmlns="http://www.pragmaticsw.com/">
<AuthenticationData>
<AppCode>agSP</AppCode>
<DeptId>7154</DeptId>
<ProjId>1032</ProjId>
<UserId>25315</UserId>
<PassCode>p@ssword</PassCode>
</AuthenticationData>
<ContactId>4</ContactId>
</Contacts_Load>
</soap12:Body>
</soap12:Envelope>
Sample Response XML
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: 1121 {The server returns an appropriate value here}
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<Contacts_LoadResponse xmlns="http://www.pragmaticsw.com/">
<Contacts_LoadResult>
<ContactId>7</ContactId>
<ContactPerson>John Smith</ContactPerson>
<CompanyName>Smith & Doe Inc.</CompanyName>
<Email>[email protected]</Email>
<Title>Developer</Title>
<Status>Active</Status>
<ContactType>Vendor</ContactType>
<Date1stContact>2012-02-20T00:00:00</Date1stContact>
<DateCallBack>2014-07-29T00:00:00</DateCallBack>
<AssigneeUserId>27942</AssigneeUserId>
<OwnerUserId>27534</OwnerUserId>
<FolderId>52359</FolderId>
<AssignedToName>Fry, Alex</AssignedToName>
<DateCreated>2014-05-30T14:28:18.028</DateCreated>
<DateUpdated>2014-07-28T05:54:22</DateUpdated>
<ImportId>0</ImportId>
<NbrEvents>0</NbrEvents>
<NbrFiles>0</NbrFiles>
<NbrNotes>1</NbrNotes>
<OwnerName>Davis, Eugeny</OwnerName>
<UpdateUserId>27534</UpdateUserId>
<UserName>Fry, Alex</UserName>
</Contacts_LoadResult>
</Contacts_LoadResponse>
</soap:Body>
</soap:Envelope>
SOAP 1.2
HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: 1131 {The server returns an appropriate value here}
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<Contacts_LoadResponse xmlns="http://www.pragmaticsw.com/">
<Contacts_LoadResult>
<ContactId>7</ContactId>
<ContactPerson>John Smith</ContactPerson>
<CompanyName>Smith & Doe Inc.</CompanyName>
<Email>[email protected]</Email>
<Title>Developer</Title>
<Status>Active</Status>
<ContactType>Vendor</ContactType>
<Date1stContact>2012-02-20T00:00:00</Date1stContact>
<DateCallBack>2014-07-29T00:00:00</DateCallBack>
<AssigneeUserId>27942</AssigneeUserId>
<OwnerUserId>27534</OwnerUserId>
<FolderId>52359</FolderId>
<AssignedToName>Fry, Alex</AssignedToName>
<DateCreated>2014-05-30T14:28:18.028</DateCreated>
<DateUpdated>2014-07-28T05:54:22</DateUpdated>
<ImportId>0</ImportId>
<NbrEvents>0</NbrEvents>
<NbrFiles>0</NbrFiles>
<NbrNotes>1</NbrNotes>
<OwnerName>Davis, Eugeny</OwnerName>
<UpdateUserId>27534</UpdateUserId>
<UserName>Fry, Alex</UserName>
</Contacts_LoadResult>
</Contacts_LoadResponse>
</soap12:Body>
</soap12:Envelope>
See Also
Contacts_Add
Contacts_Delete
Contacts_LoadByCriteria
Contacts_Update
Contacts Operations
SOAP API Reference