Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(DataFlex) Activix CRM Create a PhoneCreate a phone. Returns the created phone. For more information, see https://docs.crm.activix.ca/api/resources/phone
Use ChilkatAx-win32.pkg Procedure Test Handle hoHttp Handle hoJsonRequestBody Boolean iSuccess String sUrl Variant vResp Handle hoResp Handle hoJsonResponse Integer iDataId String sDataCreated_at String sDataUpdated_at Integer iDataLead_id String sDataExtension String sDataNumber String sDataType Boolean iDataValid String sDataValidated Boolean iDataMobile String sTemp1 Integer iTemp1 Boolean bTemp1 // This example requires the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. Get Create (RefClass(cComChilkatHttp)) To hoHttp If (Not(IsComObjectCreated(hoHttp))) Begin Send CreateComObject of hoHttp End Set ComAuthToken Of hoHttp To "ACCESS_TOKEN" Set ComAccept Of hoHttp To "application/json" // The following JSON is sent in the request body: // { // "lead_id": 7135833, // "number": "+15141234455", // "type": "home" // } // Use this online tool to generate the code from sample JSON: // Generate Code to Create JSON Get Create (RefClass(cComChilkatJsonObject)) To hoJsonRequestBody If (Not(IsComObjectCreated(hoJsonRequestBody))) Begin Send CreateComObject of hoJsonRequestBody End Get ComUpdateInt Of hoJsonRequestBody "lead_id" 7135833 To iSuccess Get ComUpdateString Of hoJsonRequestBody "number" "+15141234455" To iSuccess Get ComUpdateString Of hoJsonRequestBody "type" "home" To iSuccess Move "https://crm.activix.ca/api/v2/lead-phones" To sUrl Get ComEmit Of hoJsonRequestBody To sTemp1 Get ComPText Of hoHttp "POST" sUrl sTemp1 "utf-8" "application/json" False False To vResp If (IsComObject(vResp)) Begin Get Create (RefClass(cComChilkatHttpResponse)) To hoResp Set pvComObject Of hoResp To vResp End Get ComLastMethodSuccess Of hoHttp To bTemp1 If (bTemp1 <> True) Begin Get ComLastErrorText Of hoHttp To sTemp1 Showln sTemp1 Procedure_Return End Get ComStatusCode Of hoResp To iTemp1 Showln "Response Status Code: " iTemp1 Get Create (RefClass(cComChilkatJsonObject)) To hoJsonResponse If (Not(IsComObjectCreated(hoJsonResponse))) Begin Send CreateComObject of hoJsonResponse End Get ComBodyStr Of hoResp To sTemp1 Get ComLoad Of hoJsonResponse sTemp1 To iSuccess Set ComEmitCompact Of hoJsonResponse To False Get ComEmit Of hoJsonResponse To sTemp1 Showln sTemp1 Get ComStatusCode Of hoResp To iTemp1 If (iTemp1 >= 300) Begin Showln "Failed." Send Destroy of hoResp Procedure_Return End Send Destroy of hoResp // Sample output... // (See the parsing code below..) // // Use the this online tool to generate parsing code from sample JSON: // Generate Parsing Code from JSON // { // "data": { // "id": 34566, // "created_at": "2018-04-09T18:05:00+00:00", // "updated_at": "2018-04-09T18:05:00+00:00", // "lead_id": 3466512, // "number": "+15141234455", // ... // } // } Get ComIntOf Of hoJsonResponse "data.id" To iDataId Get ComStringOf Of hoJsonResponse "data.created_at" To sDataCreated_at Get ComStringOf Of hoJsonResponse "data.updated_at" To sDataUpdated_at Get ComIntOf Of hoJsonResponse "data.lead_id" To iDataLead_id Get ComStringOf Of hoJsonResponse "data.extension" To sDataExtension Get ComStringOf Of hoJsonResponse "data.number" To sDataNumber Get ComStringOf Of hoJsonResponse "data.type" To sDataType Get ComBoolOf Of hoJsonResponse "data.valid" To iDataValid Get ComStringOf Of hoJsonResponse "data.validated" To sDataValidated Get ComBoolOf Of hoJsonResponse "data.mobile" To iDataMobile End_Procedure |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.