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
(PowerBuilder) MemberMouse -- getMember API CallDemonstrates how to use the getMember API call is used to retrieve information about an existing member's account. See MemberMouse getMember API call for more information.
integer li_rc oleobject loo_Req oleobject loo_Http oleobject loo_Resp oleobject loo_Json integer i integer li_NumBundles // This example assumes the Chilkat HTTP API to have been previously unlocked. // See Global Unlock Sample for sample code. // Build the POST request to get a member's data. loo_Req = create oleobject // Use "Chilkat_9_5_0.HttpRequest" for versions of Chilkat < 10.0.0 li_rc = loo_Req.ConnectToNewObject("Chilkat.HttpRequest") if li_rc < 0 then destroy loo_Req MessageBox("Error","Connecting to COM object failed") return end if // If your particular API URL is "https://mydomain.com/wp-content/plugins/membermouse/api/request.php", // then the Path part of the URL is "/wp-content/plugins/membermouse/api/request.php", // and the Domain part of the URL is "mydomain.com". // If "https" is used, then the port is 443 (not 80). loo_Req.HttpVerb = "POST" // Use the Path part of your API_URL with "?q=/getMember". // The command, such as /getMember, /createMember, etc. goes in the Path. // The remainder of the POST arguments are query params that go in the body of the request. // (Do not put the apikey and apisecret in the Path because the secret will be exposed. // You want the confidential information to be in the body of the request.) loo_Req.Path = "/wp-content/plugins/membermouse/api/request.php?q=/getMember" loo_Req.ContentType = "application/x-www-form-urlencoded" // Add the query params. // (Use your particular values in place of "MEMBERMOUSE_...") loo_Req.AddParam("apikey","MEMBERMOUSE_API_KEY") loo_Req.AddParam("apisecret","MEMBERMOUSE_API_SECRET") loo_Req.AddParam("email","some_member@somewhere.com") loo_Http = create oleobject // Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0 li_rc = loo_Http.ConnectToNewObject("Chilkat.Http") // Use the Domain part of your API URL here: loo_Resp = loo_Http.SynchronousRequest("mydomain.com",443,1,loo_Req) if loo_Http.LastMethodSuccess <> 1 then Write-Debug loo_Http.LastErrorText destroy loo_Req destroy loo_Http return end if loo_Json = create oleobject // Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0 li_rc = loo_Json.ConnectToNewObject("Chilkat.JsonObject") loo_Json.Load(loo_Resp.BodyStr) loo_Json.EmitCompact = 0 // A sample JSON response is shown below.. Write-Debug loo_Json.Emit() Write-Debug "Response Status Code: " + string(loo_Resp.StatusCode) // A response code of 200 is success. if loo_Resp.StatusCode = 200 then // Show a few values from the JSON.. Write-Debug "first_name: " + loo_Json.StringOf("response_data.first_name") Write-Debug "last_name: " + loo_Json.StringOf("response_data.last_name") // Iterate over the bundles. i = 0 li_NumBundles = loo_Json.SizeOfArray("response_data.bundles") do while i < li_NumBundles loo_Json.I = i Write-Debug "Bundle: " + loo_Json.StringOf("response_data.bundles[i].name") i = i + 1 loop end if destroy loo_Resp // ---------------------------------------------------- // Sample JSON response for /getMember // ---------------------------------------------------- // { // "response_code": "200", // "response_message": "", // "response_data": { // "member_id": 59, // "first_name": "Jim", // "last_name": "Smith", // "is_complimentary": "false", // "registered": "2003-08-08 00:00:00", // "cancellation_date": "", // "last_logged_in": "2017-04-28 16:26:06", // "last_updated": "2017-04-28 16:26:06", // "days_as_member": 5013, // "status": "1", // "status_name": "Active", // "membership_level": "12", // "membership_level_name": "Expert Instructor", // "username": "JSmith", // "email": "some_member@somewhere.com", // "password": null, // "phone": "(618) 555-5555", // "billing_address": "555 Shady Lane", // "billing_city": "Wheaton", // "billing_state": "IL", // "billing_zip": "60187", // "billing_country": "United States", // "shipping_address": "555 Shady Lane", // "shipping_city": "Wheaton", // "shipping_state": "IL", // "shipping_zip": "60187", // "shipping_country": "United States", // "bundles": [ // { // "id": "6", // "name": "ABC Bundle", // "is_complimentary": "false", // "days_with_bundle": 2758, // "status": "1", // "status_name": "Active", // "date_added": "2009-10-10 00:00:00", // "last_updated": "2017-03-26 13:00:30" // }, // { // "id": "8", // "name": "XZ 2.0 Software License", // "is_complimentary": "false", // "days_with_bundle": 2758, // "status": "1", // "status_name": "Active", // "date_added": "2009-10-10 00:00:00", // "last_updated": "2017-03-26 13:00:30" // } // ], // "custom_fields": [ // { // "id": 1, // "name": "Class Location:", // "value": "" // }, // { // "id": 2, // "name": "Company", // "value": "Acme Interiors Inc" // }, // { // "id": 3, // "name": "Referred by:", // "value": "" // }, // { // "id": 4, // "name": "Sound Analysis Equipment", // "value": "AudioTools Sound Analyzer with HAA multi mic Kit" // }, // { // "id": 5, // "name": "HAA Member Number", // "value": "22222222" // }, // { // "id": 6, // "name": "Alumni Class Dates", // "value": "" // } // ] // } // } // destroy loo_Req destroy loo_Http destroy loo_Json |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.