Create the job for TASQ.
URL:
https://jobapi.tasq.com.au/api/Job/CreateJob
Supports:
POST.
Attribute Details:
Company Validate Info | (object) | must |
Login Name | (string) | |
Client IP | (string) | |
Password | (string) | |
Mobile Device Token | (string) | |
Web Api TOKEN | (Guid) | |
Job Transaction Header | (object) | |
Job Transaction Header ID | (Guid) | optional |
Reference No | (string)(50) | optional |
Job Type
Invoice / Credit Note / Order / Quote |
(string) (20) | must |
Job Status | (string) (20) | optional |
Transaction Date | (date) | must |
Client ID | (Guid) | must |
Client Purchase No | (string) (40) | optional |
Job Category ID | (Guid) | optional |
Has Approval | (bool) | optional |
Due Date | (date) | If Job Type is Invoice must; else optional |
SubTotal | (decimal) (18.6) | optional |
Tax Total | (decimal) (18.6) | optional |
Total Amount | (decimal) (18.6) | optional |
Memo | (string) | optional |
Job Address | (string) (200) | |
Job Address Line 2 | (string) (200) | optional |
Job City | (string) (200) | optional |
Job State | (string) (200) | optional |
Job Postal Code | (string) (50) | optional |
Job Country | (string) (50) | optional |
Job Contact Title | (string) (50) | optional |
Job Contact First Name | (string) (200) | optional |
Job Contact Last Name | (string) (200) | optional |
Job Contact Phone | (string) (50) | optional |
Job Contact Fax | (string) (50) | optional |
Job Contact Mobile | (string) (50) | optional |
Job Contact Email | (string) (50) | optional |
Job Description | (string) | optional |
Is Same As Job Address | (bool) | must |
Billing Address | (string) (200) | optional |
Billing Address Line 2 | (string) (200) | optional |
Billing City | (string) (200) | optional |
Billing State | (string) (200) | optional |
Billing Postal Code | (string) (50) | optional |
Billing Country | (string) (50) | optional |
Is Same As Job Contact | (bool) | must |
Billing Contact Title | (string) (50) | optional |
Billing Contact First Name | (string) (200) | optional |
Billing Contact Last Name | (string) (200) | optional |
Billing Contact Phone | (string) (50) | optional |
Billing Contact Fax | (string) (50) | optional |
Billing Contact Mobile | (string) (50) | optional |
Billing Contact Email | (string) (50) | optional |
Billing Memo | (string) | optional |
Is Created By Recurring | (bool) | optional |
RecurringTemplate ID | (Guid) | optional |
Has Linked Doc | (bool) | optional |
Is Show On PDF | (bool) | optional |
Tax Inclusive | (bool) | optional |
Is Deleted | (bool) | optional |
Is Job Completed | (bool) | optional |
Has Viewed | (bool) | optional |
Create Time | (date) | optional |
Last Modified Time | (date) | optional |
Closed Date | (date) | optional |
Job Transaction Detail | (array) | |
Job Transactions Detail ID | (Guid) | optional |
Job Transactions Header ID | (Guid) | optional |
Quantity | (decimal)(18,6) | optional |
Inventory ID | (Guid) | optional |
Account ID | (Guid) | optional |
Tax Code ID | (Guid) | optional |
Description | (string) | optional |
Unit Price | (decimal) (18,6) | optional |
Discount | (decimal) (5,2) | optional |
Amount | (decimal) (18,6) | optional |
Is Deleted | (bool) | optional |
Sort No | (integer) | optional |
Has Exported To Q6 | (bool) | optional |
Job Record Time ID | (Guid) | optional |
Job Schedule DateTime | (array) | |
Job Schedule Date Time ID | (Guid) | optional |
Create Time UTC | (date) | optional |
Job ID | (Guid) | optional |
User ID | (Guid) | optional |
Create Time | (date) | optional |
Schedule Date From | (date) | optional |
Schedule Date To | (date) | optional |
Schedule Date From UTC | (date) | optional |
Schedule Date To UTC | (date) | optional |
Estimate Hours | (decimal)(18,2) | optional |
Memo | (string) | optional |
Is Deleted | (bool) | optional |
Job Tasks | (array) | |
Job Task ID | (Guid) | optional |
Job Transaction Header ID | (Guid) | optional |
Job Task Create Time UTC | (date) | optional |
Job Task Create Time | (date) | optional |
Job Task Detail | (string) | optional |
Job Task Due Date | (date) | optional |
Job Task Assign To User ID | (Guid) | optional |
Has Completed | (bool) | optional |
Is Deleted | (bool) | optional |
Has Viewed | (bool) | optional |
Job Record Time | (array) | |
Job Record Time ID | (Guid) | optional |
Job ID | (Guid) | optional |
User ID | (Guid) | optional |
Job Date | (date) | optional |
Service Item ID | (Guid) | optional |
Start Recording Date Time | (date) | optional |
End Recording Date Time | (date) | optional |
Start Recording Date Time UTC | (date) | optional |
End Recording Date Time UTC | (date) | optional |
On Break Time | (decimal) (18,2) | optional |
Total Work Time | (decimal) (18,2) | optional |
Has Added In Invoice | (bool) | optional |
Is Deleted | (bool) | optional |
Rounding By | (string) (50) | optional |
Note | (array) | |
Note ID | (Guid) | optional |
Note Date Time UTC | (date) | optional |
Note Description | (string) | optional |
Is Deleted | (bool) | optional |
Job ID | (Guid) | optional |
User ID | (Guid) | optional |
Photo | (array) | |
Photo ID | (Guid) | optional |
Photo Date Time UTC | (date) | optional |
Photo Image | (byte[]) | optional |
Is Deleted | (bool) | optional |
Job ID | (Guid) | optional |
Sort No | (integer) | optional |
User ID | (Guid) | optional |
Client Sign Off | (array) | |
Client Sign Off ID | (Guid) | optional |
Client Sign Off Date Time UTC | (Guid) | optional |
Client Sign Off Image | (byte[]) | optional |
Is Deleted | (bool) | optional |
Job ID | (Guid) | optional |
User ID | (Guid) | optional |
Send From User ID | (Guid) | optional |
Example JSON POST data:
{
"CompanyValidateInfo": {
"ClientIP": null,
"LoginName": "testapi@tasq.com.au",
"MobileDeviceToken": null,
"Password": "test123.",
"WebApiTOKEN": "b3b777b0-c7af-458d-be64-b3d6d760177f"
},
"JobTransactionHeader": {
"JobTransactionHeaderID": null,
"ReferenceNo": "JOB00000074",
"JobType": "Invoice",
"JobStatus": "Open",
"TransactionDate": "2018-11-12T14:46:54.932",
"ClientID": "f8ec9a3c-a76e-4447-9bc6-7a5a9fe42c52",
"ClientPurchaseNo": "",
"JobCategoryID": null,
"HasApproval": null,
"DueDate": "2020-11-27T00:00:00",
"SubTotal": null,
"TaxTotal": null,
"TotalAmount": null,
"Memo": "",
"JobAddress": "",
"JobAddressLine2": "",
"JobCity": "",
"JobState": "",
"JobPostalCode": "",
"JobCountry": "Australia",
"JobContactTitle": "",
"JobContactFirstName": "",
"JobContactLastName": "",
"JobContactPhone": "",
"JobContactFax": "",
"JobContactMobile": "",
"JobContactEmail": "",
"JobDescription": "",
"IsSameAsJobAddress": false,
"BillingAddress": "",
"BillingAddressLine2": "",
"BillingCity": "",
"BillingState": "ACT",
"BillingPostalCode": "",
"BillingCountry": "Australia",
"IsSameAsJobContact": false,
"BillingContactTitle": "",
"BillingContactFirstName": "",
"BillingContactLastName": "",
"BillingContactPhone": "",
"BillingContactFax": "",
"BillingContactMobile": "",
"BillingContactEmail": "",
"BillingMemo": "",
"IsCreatedByRecurring": false,
"RecurringTemplateID": null,
"HasLinkedDoc": null,
"IsShowOnPDF": false,
"TaxInclusive": true,
"IsDeleted": null,
"IsJobCompleted": false,
"HasViewed": null,
"CreateTime": null,
"LastModifiedTime": "0001-01-01T00:00:00",
"ClosedDate": null,
"ClientName": "1111122221"
},
"JobTransactionDetail": [
{
"JobTransactionsDetailID": null,
"JobTransactionsHeaderID": null,
"Quantity": 1.0,
"InventoryID": "b20a5410-3d85-4dee-be84-2c541dfb2d02",
"AccountID": null,
"TaxCodeID": "a442f7fa-1210-4c5e-b6ab-26f0b57731aa",
"Description": "10service1",
"UnitPrice": 145.0,
"Discount": 0.0,
"Amount": 0.0,
"IsDeleted": null,
"SortNo": 0,
"HasExportedToQ6": null,
"JobRecordTimeID": null
},
{
"JobTransactionsDetailID": null,
"JobTransactionsHeaderID": null,
"Quantity": 1.0,
"InventoryID": "8c15a4b0-cea8-44d2-9bc1-35225f9a2d52",
"AccountID": null,
"TaxCodeID": "a442f7fa-1210-4c5e-b6ab-26f0b57731aa",
"Description": "10service12",
"UnitPrice": 145.0,
"Discount": 0.0,
"Amount": 0.0,
"IsDeleted": null,
"SortNo": 0,
"HasExportedToQ6": null,
"JobRecordTimeID": null
}
],
"JobScheduleDateTime": [
{
"JobScheduleDateTimeID": "3dff095f-5582-47ce-870f-7182ff4dcdba",
"CreateTimeUTC": null,
"JobID": "b98e6d62-1cd4-4cbe-a3bf-dcfa8b5bd8ef",
"UserID": "5b57389d-fc71-41ba-9ee6-c222b9905f03",
"CreateTime": null,
"ScheduleDateFrom": "2018-11-12T17:46:00",
"ScheduleDateTo": "2018-11-12T20:46:00",
"ScheduleDateFromUTC": null,
"ScheduleDateToUTC": null,
"EstimateHours": 3.00,
"Memo": "dfefefe",
"IsDeleted": false
}
],
"JobTasks": [
{
"JobTaskID": "63a5dead-1116-4667-b9c5-b6221b68acb1",
"JobTransactionHeaderID": "e0335e3d-d88f-4317-94db-381d6fefe8d5",
"JobTaskCreateTimeUTC": null,
"JobTaskCreateTime": null,
"JobTaskDetail": "eeeee",
"JobTaskDueDate": "2020-12-02T00:00:00",
"JobTaskAssignToUserID": "5b57389d-fc71-41ba-9ee6-c222b9905f03",
"HasCompleted": false,
"IsDeleted": false,
"HasViewed": null
}
],
"JobRecordTime": [
{
"JobRecordTimeID": "715f2655-2b8d-47da-b1a3-58bdd6a6ef62",
"JobID": "c38cd0ef-6844-42f6-b1dc-f31bfd19ce6a",
"UserID": "5b57389d-fc71-41ba-9ee6-c222b9905f03",
"JobDate": "2018-11-30T00:00:00",
"ServiceItemID": "9ea4e4fc-6f21-4dc2-a832-4d3901746850",
"StartRecordingDateTime": "2018-11-30T01:01:00",
"EndRecordingDateTime": "2018-11-30T02:01:00",
"StartRecordingDateTimeUTC": null,
"EndRecordingDateTimeUTC": null,
"OnBreakTime": null,
"TotalWorkTime": 0.98,
"HasAddedInInvoice": true,
"IsDeleted": false,
"RoundingBy": "60Mins"
}
],
"Note": [
{
"NoteID": "2b64ccc6-46b8-43dd-a4e6-40ba0eb78f33",
"NoteDateTimeUTC": "2018-11-12T06:48:00.3677107Z",
"NoteDescription": "dddddd",
"IsDeleted": false,
"JobID": "98ff9295-6a7b-4568-bcb8-3d6f23c026c6",
"UserID": "5b57389d-fc71-41ba-9ee6-c222b9905f03"
}
],
"Photo": [
"PhotoID": "00000000-0000-0000-0000-000000000000",
"PhotoDateTimeUTC": "2018-11-12T07:06:07.8777901Z",
"PhotoImage": "iVBORw0KGgoAAAANSUhEUgAABQUAAALdCAYAAACVygXMAAAgAElEQVR4nOzdDXAU553v+18IWCtebGQkAWMbZHuw1oIsCNiVUK4L2xqcEFWOUy6ym7MxTSVVtw5462TLxsVycra0WdVurg5lcCVVMWzVraTcOHty1lzXclNaTplRsNc3AjbCgqyQjRnbApvhRZIB86LFYHz76e6ZaY1m9IbQCOb7qRLMdD/99PP0gPn7P8/Ll75w6DZy+p+36IGfSb945Tn96Uzv2P6fbtTjsSf0wU8f18xEwQOv6M8/ekL/+K3S5PspG9v1N42N2rAkUdlv9OdPvy79xXOpcoGyTwaPH/iN/unex517ntE//WCLvveOc+ybT+vSDxak2vDr0j7t6q9dm1a8or8NXBdsx6Jk25xyPzijNcn+pF2XqS/ZnkOfh5e5v/2f6RDb6b/f6bz8m2DbzbUPD9AOAAAAAAAA3FQTct2Am+OMvvf0Rk1Z4f24ybj/npaAWvJ030Tfkif0i4elv/1t+yB1t2vTxnY34df3+sfTkn0L9JtAwqzqz57Qk067/nnvmWH2xbmfSaw9/ITWJBN8C7ShT0Jtgdb8hdOWXx/Ufrcti/Q3Su9Lu978tfTk4wuGl4g7/Rs9+7MzevIvnh4gmTkI51ltCLTdbes7B/Xm6RHWBwAAAAAAgBsyMdcNuDnSRuS……",
"IsDeleted": false,
"JobID": "ac0688ca-8654-4a0a-a446-a687f9fceb72",
"SortNo": 0,
"UserID": "00000000-0000-0000-0000-000000000000"
],
"ClientSignOff": [
"ClientSignOffID": "3c3f92ab-4413-4102-ab1b-46c133165677",
"ClientSignOffDateTimeUTC": "2018-11-12T15:23:44.9762246+08:00",
"ClientSignOffImage": "QEA=",
"IsDeleted": true,
"JobID": "56efdea7-c2a2-4919-8b23-777f55f1d533",
"UserID": "b752b6cb-f1d8-47d6-81cc-ba1db73a021d"
],
"SendFromUserID": "548ee0a8-a383-4867-8e41-c86b2ce80ab6"
}
Return Value:
{
ActionCode: (string) "Create",
ErrorMessage: (string), "",
IsSuccessed: (string) "YES",
RetrunData: (object) {
JobTransactionHeaderID, "68953959-81fa-41d1-8e75-d993dd12e9d3"
ClientID, "12533987-546h-bt6d-5yhf-d546812e9d3"
ReferenceNo", JOB00000071"
}
}
C# Sample Code:
public static string CreateJob (string Url ,string content)
{
string result = "";
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(Url);
req.Method = "POST";
req.ContentType = "application/json";
#region Add Post Param
byte[] data = Encoding.UTF8.GetBytes(content);
req.ContentLength = data.Length;
using (Stream reqStream = req.GetRequestStream())
{
reqStream.Write(data, 0, data.Length);
reqStream.Close();
}
#endregion
HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
Stream stream = resp.GetResponseStream();
using (StreamReader reader = new StreamReader(stream, Encoding.UTF8))
{
result = reader.ReadToEnd();
}
return result;
}
Javascript:
public static string CreateJob (string Url ,string content)
{
string result = "";
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(Url);
req.Method = "POST";
req.ContentType = "application/json";
#region Add Post Param
byte[] data = Encoding.UTF8.GetBytes(content);
req.ContentLength = data.Length;
using (Stream reqStream = req.GetRequestStream())
{
reqStream.Write(data, 0, data.Length);
reqStream.Close();
}
#endregion
HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
Stream stream = resp.GetResponseStream();
using (StreamReader reader = new StreamReader(stream, Encoding.UTF8))
{
result = reader.ReadToEnd();
}
return result;
}
function CreateJob () {
$.ajax({
type: "Post",
url: "https://jobapi.tasq.com.au/api/Job/CreateJob",
data: {
…
},
dataType: "json",
success: function (data) {
console.dir(data)
},
error: function (e) {
console.dir(e)
}
});
}
Java Sample Code:
private static void CreateJob(String json){
try {
URL url = new URL("https://jobapi.tasq.com.au/api/Job/CreateJob");
HttpURLConnection con = (HttpURLConnection)url.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type", "application/json; charset=utf-8");
con.setRequestProperty("Accept", "application/json");
con.setDoInput(true);
con.setDoOutput(true);
con.setUseCaches(false);
con.setRequestProperty("Connection", "Keep-Alive");
if (json != null){
byte[] writeBytes = json.getBytes("utf-8");
OutputStream outputStream = con.getOutputStream();
outputStream.write(writeBytes,0, writeBytes.length);
outputStream.flush();
outputStream.close();
}
if (con.getResponseCode() == HttpURLConnection.HTTP_OK){
InputStreamReader in = new InputStreamReader(con.getInputStream());
BufferedReader br = new BufferedReader(in);
StringBuilder response = new StringBuilder();
String responseLine = null;
while ((responseLine = br.readLine()) != null){
response.append(responseLine.trim());
}
System.out.println(response.toString());
}
} catch (IOException e) {
e.printStackTrace();
}
}
Swift Sample Code:
func CreateJob ()
{
let jobJSONData: JobJSONData = JobJSONData()
let UrlString = TASQSampleCommonLibrary.TASQApiUrl + "Job/CreateJob"
let loginDetail: LoginDetail = LoginDetail()
var parameters = [String:AnyObject]()
var arrayData = [String:AnyObject]()
arrayData ["WebApiTOKEN"] = TASQSampleCommonLibrary.TASQApiTOKEN as AnyObject?
arrayData ["LoginName"] = loginDetail.LoginEmail! as AnyObject?
arrayData ["Password"] = loginDetail.LoginPassword! as AnyObject?
arrayData ["ClientIP"] = TASQSampleCommonLibrary.getIPAddresses() as AnyObject?
arrayData ["MobileDeviceToken"] = TASQSampleCommonLibrary.getMobileDeviceToken() as AnyObject?
parameters["CompanyValidateInfo"] = arrayData as AnyObject?
jobJSONData.JobTransactionHeaderJSONData = getJobTransactionHeaderJsonData()
parameters["JobTransactionHeader"] = jobJSONData.JobTransactionHeaderJSONData as AnyObject
parameters["JobTransactionDetail"] = jobJSONData.JobTransactionDetailJSONData as AnyObject
parameters["JobScheduleDateTime"] = jobJSONData.JobScheduleDateTimeJSONData as AnyObject
parameters["JobTasks"] = jobJSONData.JobTasksJSONData as AnyObject
parameters["JobRecordTime"] = jobJSONData.JobRecordTimeJSONData as AnyObject
parameters["Note"] = jobJSONData.NoteJSONData as AnyObject
parameters["Photo"] = jobJSONData.PhotoJSONData as AnyObject
parameters["ClientSignOff"] = jobJSONData.ClientSignOff as AnyObject
parameters["SendFromUserID"] = "" as AnyObject
let request = NSMutableURLRequest(url: NSURL(string: UrlString)! as URL, cachePolicy: NSURLRequest.CachePolicy.reloadIgnoringLocalCacheData, timeoutInterval: 300)
let jsonString = TASQSampleCommonLibrary.convertDictionaryToJSONData(dicData: parameters)
print(jsonString)
request.httpBody = jsonString.data(using: String.Encoding.utf8, allowLossyConversion: true)
request.httpMethod = "POST"
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
do {
let config = URLSessionConfiguration.default
let session = URLSession(configuration: config)
let task = session.dataTask(with: request as URLRequest, completionHandler: {
(data, response, error) in
})
task.resume()
}
}