I have to add record using API endpoint. This is response JSON string data.
[{"id":1578,"name":"Master Services Agreement","type":{"id":14,"name":"Managed Services","_info":{"type_href":"https://sandbox-na.myconnectwise.net/v4_6_release/apis/3.0//finance/agreements/types/14"}},"company":{"id":19303,"identifier":"AA","name":"Acai Associates","_info":{"company_href":"https://sandbox-na.myconnectwise.net/v4_6_release/apis/3.0//company/companies/19303"}},"contact":{"id":107,"name":"Rafael Oranday","_info":{"contact_href":"https://sandbox-na.myconnectwise.net/v4_6_release/apis/3.0//company/contacts/107"}},"site":{"id":1095,"name":"Main Office","_info":{"site_href":"https://sandbox-na.myconnectwise.net/v4_6_release/apis/3.0//company/companies/19303/sites/1095"}},"location":{"id":11,"name":"Lake Park","_info":{"location_href":"https://sandbox-na.myconnectwise.net/v4_6_release/apis/3.0//system/locations/11"}},"department":{"id":12,"identifier":"ClientSuccess","name":"Client Success","_info":{"department_href":"https://sandbox-na.myconnectwise.net/v4_6_release/apis/3.0//system/departments/12"}},"restrictLocationFlag":false,"restrictDepartmentFlag":true,"startDate":"2019-09-24T00:00:00Z","noEndingDateFlag":true,"cancelledFlag":false,"sla":{"id":2,"name":"Standard SLA","_info":{"sla_href":"https://sandbox-na.myconnectwise.net/v4_6_release/apis/3.0//service/SLAs/2"}},"applicationUnits":"Hours","applicationLimit":0.00,"applicationCycle":"CalendarMonth","applicationUnlimitedFlag":true,"oneTimeFlag":false,"coverAgreementTime":true,"coverAgreementProduct":false,"coverAgreementExpense":false,"coverSalesTax":false,"carryOverUnused":false,"allowOverruns":false,"expireWhenZero":false,"chargeToFirm":false,"employeeCompRate":"Actual","employeeCompNotExceed":"Billing","compHourlyRate":0.00,"compLimitAmount":0.00,"billingCycle":{"id":2,"name":"Monthly"},"billOneTimeFlag":false,"billingTerms":{"id":1,"name":"Net 30 days"},"invoicingCycle":"ContractYear","billToCompany":{"id":19303,"identifier":"AA","name":"Acai Associates","_info":{"company_href":"https://sandbox-na.myconnectwise.net/v4_6_release/apis/3.0//company/companies/19303"}},"billToContact":{"id":107,"name":"Rafael Oranday","_info":{"contact_href":"https://sandbox-na.myconnectwise.net/v4_6_release/apis/3.0//company/contacts/107"}},"billToSite":{"id":1095,"name":"Main Office","_info":{"site_href":"https://sandbox-na.myconnectwise.net/v4_6_release/apis/3.0//company/companies/19303/sites/1095"}},"billAmount":0.00,"taxable":false,"billStartDate":"2022-06-01T00:00:00Z","taxCode":{"id":8,"name":"AVATAX","_info":{"taxCode_href":"https://sandbox-na.myconnectwise.net/v4_6_release/apis/3.0//finance/taxCodes/8"}},"restrictDownPayment":true,"prorateFlag":false,"invoiceDescription":"","topComment":false,"bottomComment":false,"billTime":"NoDefault","billExpenses":"NoDefault","billProducts":"NoDefault","billableTimeInvoice":false,"billableExpenseInvoice":false,"billableProductInvoice":false,"currency":{"id":7,"symbol":"$","currencyCode":"USD","decimalSeparator":".","numberOfDecimals":2,"thousandsSeparator":",","negativeParenthesesFlag":false,"displaySymbolFlag":true,"currencyIdentifier":"USD","displayIdFlag":false,"rightAlign":false,"name":"US Dollars","_info":{"currency_href":"https://sandbox-na.myconnectwise.net/v4_6_release/apis/3.0//finance/currencies/7"}},"autoInvoiceFlag":false,"nextInvoiceDate":"2023-01-01T00:00:00Z","companyLocation":{"id":18,"name":"SMB General","_info":{"location_href":"https://sandbox-na.myconnectwise.net/v4_6_release/apis/3.0//system/locations/18"}},"agreementStatus":"Active","_info":{"lastUpdated":"2022-05-24T18:25:26Z","updatedBy":"BPosner "},"customFields":[{"id":32,"caption":"MSA Start Date","type":"Date","entryMethod":"EntryField","numberOfDecimals":0,"value":"2019-09-24T00:00:00Z"},{"id":33,"caption":"MSA End Date","type":"Date","entryMethod":"EntryField","numberOfDecimals":0,"value":"2022-09-24T00:00:00Z"},{"id":35,"caption":"Contract Sales Person","type":"Text","entryMethod":"EntryField","numberOfDecimals":0},{"id":36,"caption":"Hourly Rate Out of Scope","type":"Number","entryMethod":"EntryField","numberOfDecimals":2},{"id":37,"caption":"Increase Clause ","type":"Text","entryMethod":"EntryField","numberOfDecimals":0},{"id":38,"caption":"Increase %","type":"Percent","entryMethod":"EntryField","numberOfDecimals":2},{"id":39,"caption":"Hourly Rate","type":"Number","entryMethod":"EntryField","numberOfDecimals":2},{"id":40,"caption":"MSA Term (yr)","type":"Number","entryMethod":"EntryField","numberOfDecimals":2,"value":3.0},{"id":41,"caption":"MSA Client Executer ","type":"Text","entryMethod":"EntryField","numberOfDecimals":0},{"id":42,"caption":"MSA Standard vs Non","type":"Text","entryMethod":"List","numberOfDecimals":0,"value":"Standard"}]},{"id":1698,"name":"Centrestack","type":{"id":29,"name":"Cloud/Hosted Services","_info":{"type_href":"https://sandbox-na.myconnectwise.net/v4_6_release/apis/3.0//finance/agreements/types/29"}},"company":{"id":19305,"identifier":"AG","name":"Adler Group","_info":{"company_href":"https://sandbox-na.myconnectwise.net/v4_6_release/apis/3.0//company/companies/19305"}},"contact":{"id":114,"name":"Tina Spano","_info":{"contact_href":"https://sandbox-na.myconnectwise.net/v4_6_release/apis/3.0//company/contacts/114"}},"site":{"id":1097,"name":"Main Office","_info":{"site_href":"https://sandbox-na.myconnectwise.net/v4_6_release/apis/3.0//company/companies/19305/sites/1097"}},"customerPO":"","location":{"id":11,"name":"Lake Park","_info":{"location_href":"https://sandbox-na.myconnectwise.net/v4_6_release/apis/3.0//system/locations/11"}},"department":{"id":12,"identifier":"ClientSuccess","name":"Client Success","_info":{"department_href":"https://sandbox-na.myconnectwise.net/v4_6_release/apis/3.0//system/departments/12"}},"restrictLocationFlag":false,"restrictDepartmentFlag":false,"startDate":"2022-12-01T00:00:00Z","noEndingDateFlag":true,"opportunity":{"id":633,"name":"Adler Group- Centrestack Support","_info":{"opportunity_href":"https://sandbox-na.myconnectwise.net/v4_6_release/apis/3.0//sales/opportunities/633"}},"cancelledFlag":false,"sla":{"id":2,"name":"Standard SLA","_info":{"sla_href":"https://sandbox-na.myconnectwise.net/v4_6_release/apis/3.0//service/SLAs/2"}},"applicationUnits":"Hours","applicationLimit":0.00,"applicationCycle":"CalendarMonth","applicationUnlimitedFlag":true,"oneTimeFlag":false,"coverAgreementTime":true,"coverAgreementProduct":false,"coverAgreementExpense":false,"coverSalesTax":false,"carryOverUnused":false,"allowOverruns":false,"expireWhenZero":false,"chargeToFirm":false,"employeeCompRate":"Actual","employeeCompNotExceed":"Billing","compHourlyRate":0.00,"compLimitAmount":0.00,"billingCycle":{"id":2,"name":"Monthly"},"billOneTimeFlag":false,"billingTerms":{"id":1,"name":"Net 30 days"},"invoicingCycle":"CalendarYear","billToCompany":{"id":19305,"identifier":"AG","name":"Adler Group","_info":{"company_href":"https://sandbox-na.myconnectwise.net/v4_6_release/apis/3.0//company/companies/19305"}},"billToContact":{"id":114,"name":"Tina Spano","_info":{"contact_href":"https://sandbox-na.myconnectwise.net/v4_6_release/apis/3.0//company/contacts/114"}},"billToSite":{"id":1097,"name":"Main Office","_info":{"site_href":"https://sandbox-na.myconnectwise.net/v4_6_release/apis/3.0//company/companies/19305/sites/1097"}},"billAmount":0.00,"taxable":false,"billStartDate":"2022-12-01T00:00:00Z","taxCode":{"id":8,"name":"AVATAX","_info":{"taxCode_href":"https://sandbox-na.myconnectwise.net/v4_6_release/apis/3.0//finance/taxCodes/8"}},"restrictDownPayment":true,"prorateFlag":false,"topComment":false,"bottomComment":false,"billTime":"NoDefault","billExpenses":"NoDefault","billProducts":"NoDefault","billableTimeInvoice":false,"billableExpenseInvoice":false,"billableProductInvoice":false,"currency":{"id":7,"symbol":"$","currencyCode":"USD","decimalSeparator":".","numberOfDecimals":2,"thousandsSeparator":",","negativeParenthesesFlag":false,"displaySymbolFlag":true,"currencyIdentifier":"USD","displayIdFlag":false,"rightAlign":false,"name":"US Dollars","_info":{"currency_href":"https://sandbox-na.myconnectwise.net/v4_6_release/apis/3.0//finance/currencies/7"}},"autoInvoiceFlag":false,"nextInvoiceDate":"2023-01-01T00:00:00Z","companyLocation":{"id":18,"name":"SMB General","_info":{"location_href":"https://sandbox-na.myconnectwise.net/v4_6_release/apis/3.0//system/locations/18"}},"agreementStatus":"Active","_info":{"lastUpdated":"2022-12-02T14:00:50Z","updatedBy":"MKornak "},"customFields":[{"id":32,"caption":"MSA Start Date","type":"Date","entryMethod":"EntryField","numberOfDecimals":0},{"id":33,"caption":"MSA End Date","type":"Date","entryMethod":"EntryField","numberOfDecimals":0},{"id":35,"caption":"Contract Sales Person","type":"Text","entryMethod":"EntryField","numberOfDecimals":0},{"id":36,"caption":"Hourly Rate Out of Scope","type":"Number","entryMethod":"EntryField","numberOfDecimals":2},{"id":37,"caption":"Increase Clause ","type":"Text","entryMethod":"EntryField","numberOfDecimals":0},{"id":38,"caption":"Increase %","type":"Percent","entryMethod":"EntryField","numberOfDecimals":2},{"id":39,"caption":"Hourly Rate","type":"Number","entryMethod":"EntryField","numberOfDecimals":2},{"id":40,"caption":"MSA Term (yr)","type":"Number","entryMethod":"EntryField","numberOfDecimals":2},{"id":41,"caption":"MSA Client Executer ","type":"Text","entryMethod":"EntryField","numberOfDecimals":0},{"id":42,"caption":"MSA Standard vs Non","type":"Text","entryMethod":"List","numberOfDecimals":0}]},{"id":1580,"name":"Master Services Agreement","type":{"id":14,"name":"Managed Services","_info":{"type_href":"https://sandbox-na.myconnectwise.net/v4_6_release/apis/3.0//finance/agreements/types/14"}},"company":{"id":19468,"identifier":"AVS","name":"Advanced Vascular Solutions","_info":{"company_href":"https://sandbox-na.myconnectwise.net/v4_6_release/apis/3.0//company/companies/19468"}},"contact":{"id":321,"name":"Effie Campion","_info":{"contact_href":"https://sandbox-na.myconnectwise.net/v4_6_release/apis/3.0//company/contacts/321"}},"site":{"id":1469,"name":"Main Office","_info":{"site_href":"https://sandbox-na.myconnectwise.net/v4_6_release/apis/3.0//company/companies/19468/sites/1469"}},"location":{"id":11,"name":"Lake Park","_info":{"location_href":"https://sandbox-na.myconnectwise.net/v4_6_release/apis/3.0//system/locations/11"}},"department":{"id":12,"identifier":"ClientSuccess","name":"Client Success","_info":{"department_href":"https://sandbox-na.myconnectwise.net/v4_6_release/apis/3.0//system/departments/12"}},"restrictLocationFlag":false,"restrictDepartmentFlag":true,"startDate":"2021-11-05T00:00:00Z","noEndingDateFlag":true,"cancelledFlag":false,"sla":{"id":2,"name":"Standard SLA","_info":{"sla_href":"https://sandbox-na.myconnectwise.net/v4_6_release/apis/3.0//service/SLAs/2"}},"applicationUnits":"Hours","applicationLimit":0.00,"applicationCycle":"CalendarMonth","applicationUnlimitedFlag":true,"oneTimeFlag":false,"coverAgreementTime":true,"coverAgreementProduct":false,"coverAgreementExpense":false,"coverSalesTax":false,"carryOverUnused":false,"allowOverruns":false,"expireWhenZero":false,"chargeToFirm":false,"employeeCompRate":"Actual","employeeCompNotExceed":"Billing","compHourlyRate":0.00,"compLimitAmount":0.00,"billingCycle":{"id":2,"name":"Monthly"},"billOneTimeFlag":false,"billingTerms":{"id":16,"name":"Wise-Pay (Net 30 days No Surcharge)"},"invoicingCycle":"ContractYear","billToCompany":{"id":19468,"identifier":"AVS","name":"Advanced Vascular Solutions","_info":{"company_href":"https://sandbox-na.myconnectwise.net/v4_6_release/apis/3.0//company/companies/19468"}},"billToContact":{"id":321,"name":"Effie Campion","_info":{"contact_href":"https://sandbox-na.myconnectwise.net/v4_6_release/apis/3.0//company/contacts/321"}},"billToSite":{"id":1469,"name":"Main Office","_info":{"site_href":"https://sandbox-na.myconnectwise.net/v4_6_release/apis/3.0//company/companies/19468/sites/1469"}},"billAmount":0.00,"taxable":false,"billStartDate":"2022-06-01T00:00:00Z","taxCode":{"id":8,"name":"AVATAX","_info":{"taxCode_href":"https://sandbox-na.myconnectwise.net/v4_6_release/apis/3.0//finance/taxCodes/8"}},"restrictDownPayment":true,"prorateFlag":false,"invoiceDescription":"","topComment":false,"bottomComment":false,"invoiceTemplate":{"id":1,"name":"Default Invoice Template","_info":{"billingTerms_Href":"https://sandbox-na.myconnectwise.net/v4_6_release/apis/3.0//finance/invoiceTemplateSetups/1"}},"billTime":"NoDefault","billExpenses":"NoDefault","billProducts":"NoDefault","billableTimeInvoice":false,"billableExpenseInvoice":false,"billableProductInvoice":false,"currency":{"id":7,"symbol":"$","currencyCode":"USD","decimalSeparator":".","numberOfDecimals":2,"thousandsSeparator":",","negativeParenthesesFlag":false,"displaySymbolFlag":true,"currencyIdentifier":"USD","displayIdFlag":false,"rightAlign":false,"name":"US Dollars","_info":{"currency_href":"https://sandbox-na.myconnectwise.net/v4_6_release/apis/3.0//finance/currencies/7"}},"autoInvoiceFlag":false,"nextInvoiceDate":"2023-01-01T00:00:00Z","companyLocation":{"id":23,"name":"SMB Medical ","_info":{"location_href":"https://sandbox-na.myconnectwise.net/v4_6_release/apis/3.0//system/locations/23"}},"agreementStatus":"Active","_info":{"lastUpdated":"2022-09-12T20:33:01Z","updatedBy":"KPostel "},"customFields":[{"id":32,"caption":"MSA Start Date","type":"Date","entryMethod":"EntryField","numberOfDecimals":0,"value":"2021-11-05T00:00:00Z"},{"id":33,"caption":"MSA End Date","type":"Date","entryMethod":"EntryField","numberOfDecimals":0,"value":"2024-11-05T00:00:00Z"},{"id":35,"caption":"Contract Sales Person","type":"Text","entryMethod":"EntryField","numberOfDecimals":0},{"id":36,"caption":"Hourly Rate Out of Scope","type":"Number","entryMethod":"EntryField","numberOfDecimals":2},{"id":37,"caption":"Increase Clause ","type":"Text","entryMethod":"EntryField","numberOfDecimals":0},{"id":38,"caption":"Increase %","type":"Percent","entryMethod":"EntryField","numberOfDecimals":2},{"id":39,"caption":"Hourly Rate","type":"Number","entryMethod":"EntryField","numberOfDecimals":2},{"id":40,"caption":"MSA Term (yr)","type":"Number","entryMethod":"EntryField","numberOfDecimals":2,"value":3.0},{"id":41,"caption":"MSA Client Executer ","type":"Text","entryMethod":"EntryField","numberOfDecimals":0},{"id":42,"caption":"MSA Standard vs Non","type":"Text","entryMethod":"List","numberOfDecimals":0,"value":"Standard"}]},{"id":986,"name":"Annual Domain Renewal","type":{"id":29,"name":"Cloud/Hosted Services","_info":{"type_href":"https://sandbox-na.myconnectwise.net/v4_6_release/apis/3.0//finance/agreements/types/29"}},"company":{"id":19468,"identifier":"AVS","name":"Advanced Vascular Solutions","_info":{"company_href":"https://sandbox-na.myconnectwise.net/v4_6_release/apis/3.0//company/companies/19468"}},"contact":{"id":321,"name":"Effie Campion","_info":{"contact_href":"https://sandbox-na.myconnectwise.net/v4_6_release/apis/3.0//company/contacts/321"}},"site":{"id":1469,"name":"Main Office","_info":{"site_href":"https://sandbox-na.myconnectwise.net/v4_6_release/apis/3.0//company/companies/19468/sites/1469"}},"location":{"id":11,"name":"Lake Park","_info":{"location_href":"https://sandbox-na.myconnectwise.net/v4_6_release/apis/3.0//system/locations/11"}},"department":{"id":1,"identifier":"Service","name":"Service","_info":{"department_href":"https://sandbox-na.myconnectwise.net/v4_6_release/apis/3.0//system/departments/1"}},"restrictLocationFlag":false,"restrictDepartmentFlag":false,"startDate":"2022-04-01T00:00:00Z","noEndingDateFlag":true,"cancelledFlag":false,"sla":{"id":2,"name":"Standard SLA","_info":{"sla_href":"https://sandbox-na.myconnectwise.net/v4_6_release/apis/3.0//service/SLAs/2"}},"applicationUnits":"Hours","applicationLimit":0.00,"applicationCycle":"CalendarMonth","applicationUnlimitedFlag":true,"oneTimeFlag":false,"coverAgreementTime":true,"coverAgreementProduct":false,"coverAgreementExpense":false,"coverSalesTax":false,"carryOverUnused":false,"allowOverruns":false,"expireWhenZero":false,"chargeToFirm":false,"employeeCompRate":"Actual","employeeCompNotExceed":"Billing","compHourlyRate":0.00,"compLimitAmount":0.00,"billingCycle":{"id":6,"name":"Annual"},"billOneTimeFlag":false,"billingTerms":{"id":16,"name":"Wise-Pay (Net 30 days No Surcharge)"},"invoicingCycle":"CalendarYear","billToCompany":{"id":19468,"identifier":"AVS","name":"Advanced Vascular Solutions","_info":{"company_href":"https://sandbox-na.myconnectwise.net/v4_6_release/apis/3.0//company/companies/19468"}},"billToContact":{"id":321,"name":"Effie Campion","_info":{"contact_href":"https://sandbox-na.myconnectwise.net/v4_6_release/apis/3.0//company/contacts/321"}},"billAmount":0.00,"taxable":false,"billStartDate":"2022-04-01T00:00:00Z","taxCode":{"id":8,"name":"AVATAX","_info":{"taxCode_href":"https://sandbox-na.myconnectwise.net/v4_6_release/apis/3.0//finance/taxCodes/8"}},"restrictDownPayment":false,"prorateFlag":false,"topComment":false,"bottomComment":false,"invoiceTemplate":{"id":10,"name":"Monthly Agreement with Location Breakout","_info":{"billingTerms_Href":"https://sandbox-na.myconnectwise.net/v4_6_release/apis/3.0//finance/invoiceTemplateSetups/10"}},"billTime":"NoDefault","billExpenses":"NoDefault","billProducts":"NoDefault","billableTimeInvoice":false,"billableExpenseInvoice":false,"billableProductInvoice":false,"currency":{"id":7,"symbol":"$","currencyCode":"USD","decimalSeparator":".","numberOfDecimals":2,"thousandsSeparator":",","negativeParenthesesFlag":false,"displaySymbolFlag":true,"currencyIdentifier":"USD","displayIdFlag":false,"rightAlign":false,"name":"US Dollars","_info":{"currency_href":"https://sandbox-na.myconnectwise.net/v4_6_release/apis/3.0//finance/currencies/7"}},"autoInvoiceFlag":false,"nextInvoiceDate":"2022-01-01T00:00:00Z","companyLocation":{"id":23,"name":"SMB Medical ","_info":{"location_href":"https://sandbox-na.myconnectwise.net/v4_6_release/apis/3.0//system/locations/23"}},"agreementStatus":"Active","_info":{"lastUpdated":"2022-05-25T19:13:52Z","updatedBy":"MKornak "},"customFields":[{"id":32,"caption":"MSA Start Date","type":"Date","entryMethod":"EntryField","numberOfDecimals":0},{"id":33,"caption":"MSA End Date","type":"Date","entryMethod":"EntryField","numberOfDecimals":0},{"id":35,"caption":"Contract Sales Person","type":"Text","entryMethod":"EntryField","numberOfDecimals":0},{"id":36,"caption":"Hourly Rate Out of Scope","type":"Number","entryMethod":"EntryField","numberOfDecimals":2},{"id":37,"caption":"Increase Clause ","type":"Text","entryMethod":"EntryField","numberOfDecimals":0},{"id":38,"caption":"Increase %","type":"Percent","entryMethod":"EntryField","numberOfDecimals":2},{"id":39,"caption":"Hourly Rate","type":"Number","entryMethod":"EntryField","numberOfDecimals":2},{"id":40,"caption":"MSA Term (yr)","type":"Number","entryMethod":"EntryField","numberOfDecimals":2},{"id":41,"caption":"MSA Client Executer ","type":"Text","entryMethod":"EntryField","numberOfDecimals":0},{"id":42,"caption":"MSA Standard vs Non","type":"Text","entryMethod":"List","numberOfDecimals":0}]}]
Now I need add another record using method POST. This is body:
{
"name": "Data Protection Z",
"type": {
"id": 33
},
"company": {
"id": 19303
},
"contact": {
"id": 107
},
"site": {
"id": 1095
},
"location": {
"id": 11
},
"sla": {
"id": 2
},
"invoicingCycle": "ContractYear",
"startDate": "2023-03-01",
"billStartDate": "2023-03-01",
"billingTerms": {
"id": 1
},
"billToCompany": {
"id": 19303
},
"billToContact": {
"id": 107
},
"billToSite": {
"id": 1095
},
"noEndingDateFlag": true
}
But I have to add to this body custom Fields. Some value for MSA Start Date, MSA End Date, MSA Term and MSA Standard vs. none. You can see it on JSON string.
I have to add new record using method POST. For add this record I have to create request body. My code this:
Dim body = "{
"name": "Data Protection Z",
"type": {
"id": 33
},
"company": {
"id": 19303
},
"contact": {
"id": 107
},
"site": {
"id": 1095
},
"location": {
"id": 11
},
"sla": {
"id": 2
},
"invoicingCycle": "ContractYear",
"startDate": "2023-03-01",
"billStartDate": "2023-03-01",
"billingTerms": {
"id": 1
},
"billToCompany": {
"id": 19303
},
"billToContact": {
"id": 107
},
"billToSite": {
"id": 1095
},
"noEndingDateFlag": true
}"
Dim request = New RestSharp.RestRequest(Method.POST)
request.AddHeader("ClientID", "zzzzzzzzz")
request.AddHeader("Authorization", "Basic " & base64Encoded)
request.AddHeader("Content-Type", "application/json")
request.AddParameter("application/json", body, ParameterType.RequestBody)
Dim response As RestResponse = client.Execute(request)
But in body I have to add customFields fields.
"customFields": [
{
"id": 0,
"caption": "string",
"type": "TextArea",
"entryMethod": "Date",
"numberOfDecimals": 0,
"value": {}
}
Thanks,
Alex