Here is some sample code written in .net c#
//Initialize service connection parameters
NetworkCredential serviceCreds = new NetworkCredential("[Your Username]", "[Your Password]");
CredentialCache cache = new CredentialCache();
Uri serviceUri = new Uri("https://api.connect2field.com/C2FDataSvc.svc");
cache.Add(serviceUri, "Basic", serviceCreds);
//Instantiate service reference
ServiceReference1.C2FEntities reff = new ServiceReference1.C2FEntities(serviceUri);
reff.Credentials = cache;
//Query service for particular client
ServiceReference1.Clients client = (from c in reff.Clients
where c.Company_Name == "Client 3"
select c).First();
//reff.Clients.(c=> c.Company_Name.Contains("Client 3")); //Can use any LINQ query here
//Query service for particular contact of the client
ServiceReference1.ClientContacts contact = (from c in reff.ClientContacts
where (c.Client_Id == client.Client_Id && c.Contact_FName.Contains("Wu"))
select c).First();
//Query service for state
ServiceReference1.StateMaster state = (from s in reff.StateMasters
where (s.State_Name.Contains("NSW"))
select s).First();
//Query service for country
ServiceReference1.CountryMaster country = (from c in reff.CountryMasters
where (c.Country_Name.Contains("Australia"))
select c).First();
//Query service for JobType
ServiceReference1.JobTypeM jobType = (from t in reff.JobTypeMs
where (t.Jobtype_Name.Contains("Service Job"))
select t).First();
//Query service for Fieldworker
//Add Job for the client
ServiceReference1.Jobs newJob = new ServiceReference1.Jobs();
newJob.Client_Id = client.Client_Id; //From Clients
newJob.Job_Priority = 1;
newJob.Job_Code = "2223";
newJob.Contact_Id = contact.Contact_Id; //From ClientContacts
newJob.State_Id = state.State_Id; //From State
newJob.Country_Id = country.Country_Id; //From Country
newJob.Street1 = "aaa";
newJob.Street2 = "bbb";
newJob.Suburb = "JobCity";
newJob.Postcode = "1222";
newJob.JobStatus_Id = 1; //(Not Dispatched)From JobStatus
newJob.Job_Type = 2477; //From JobTypes
newJob.JobDescription = "Test Job";
newJob.JobNotes = "Added through API";
newJob.JobStart_DateTime = DateTime.UtcNow; //Is to be saved in UTC
newJob.JobFinish_DateTime = ( DateTime.UtcNow).AddHours(1); //Is to be saved in UTC
newJob.Added_By_Type = "C";
//These are mandatory and have to set as empty even if not required
newJob.JobAddition_DateTime = DateTime.UtcNow;
newJob.JobModification_DateTime = DateTime.UtcNow;
newJob.Completed_Notes = "";
newJob.Job_Cancellation_Reason = string.Empty;
newJob.PurchaseOrderNumber = string.Empty;
newJob.Job_Latitude = string.Empty;
newJob.Job_Longitude = string.Empty;
newJob.Due_Date = null;
newJob.Travel_Start = null;
newJob.Travel_Finish = null;
newJob.SpecialNotes = string.Empty;
newJob.Tenant_Id = client.Tenant_Id;//This must be set to any existing tenant id that has been passed in
reff.AddToJobs(newJob);
reff.SaveChanges();
//Adding New Client
ServiceReference1.Clients objClient = new ServiceReference1.Clients();
objClient.Street1 = "Address 1";
objClient.Postcode = "1111";
objClient.Phone = "2222";
objClient.Mobile = "3333";
objClient.Suburb = "MyCity";
objClient.Company_Name = "Test Store";
objClient.Contact_Name = "TestNickName";
//objClient.AccountType_Id = 1;
objClient.State_Id = state.State_Id;
objClient.Country_Id = country.Country_Id;
objClient.Email_Id = "raju@testc.com";
objClient.ABN = "Test ABN1";
objClient.CardID = "TestCardID11";
objClient.ClientImage_Name = "TestImageName11";
objClient.Client_Code = "TestCode11";
objClient.CompanyTaxNumber = "TestTaxNo11";
objClient.RegisteredCompanyNumber = "TestComRegNo11";
objClient.Fax = "TestFaxNo11";
objClient.Notes = "TestNotes11";
objClient.OtherSource_Name = string.Empty;
objClient.Status = true;
objClient.Tenant_Id = client.Tenant_Id;
objClient.Street2 = string.Empty;
objClient.Date_Created = System.DateTime.Now;
objClient.Date_Updated = System.DateTime.Now.AddDays(2);
reff.AddToClients(objClient);
try
{
reff.SaveChanges();
}
catch (Exception e1)
{
MessageBox.Show(e1.InnerException.Message);
}
Click and connect