Chilkat Examples

ChilkatHOME.NET Core C#Android™AutoItCC#C++Chilkat2-PythonCkPythonClassic ASPDataFlexDelphi ActiveXDelphi DLLGoJavaLianjaMono C#Node.jsObjective-CPHP ActiveXPHP ExtensionPerlPowerBuilderPowerShellPureBasicRubySQL ServerSwift 2Swift 3,4,5...TclUnicode CUnicode C++VB.NETVBScriptVisual Basic 6.0Visual FoxProXojo Plugin

Go Web API Examples

Primary Categories

ABN AMRO
AWS Secrets Manager
AWS Security Token Service
AWS Translate
Activix CRM
Adyen
Alibaba Cloud OSS
Amazon Cognito
Amazon DynamoDB
Amazon MWS
Amazon Pay
Amazon Rekognition
Amazon SP-API
Amazon Voice ID
Aruba Fatturazione
Azure Maps
Azure Monitor
Azure OAuth2
Azure Storage Accounts
Backblaze S3
Banco Inter
Belgian eHealth Platform
Bitfinex v2 REST
Bluzone
BrickLink
Bunny CDN
CallRail
CardConnect
Cerved
ClickBank
Clickatell
Cloudfare
Constant Contact
DocuSign
Duo Auth MFA
ETrade
Ecwid
Egypt ITIDA
Egypt eReceipt
Etsy
Facebook
Faire
Frame.io
GeoOp
GetHarvest
Global Payments
Google People
Google Search Console
Google Translate
Google Vision
Hungary NAV Invoicing
IBM Text to Speech
Ibanity
IntakeQ
JCC Cyprus
Jira
Lightspeed
MYOB
Magento
Mailgun
Malaysia MyInvois

Mastercard
MedTunnel
MercadoLibre
MessageMedia
Microsoft Calendar
Microsoft Group
Microsoft Tasks and Plans
Microsoft Teams
Moody's
Okta OAuth/OIDC
OneLogin OIDC
OneNote
OpenAI ChatGPT
PRODA
PayPal
Paynow.pl
Peoplevox
Populi
QuickBooks
Rabobank
Refinitiv
Royal Mail OBA
SCiS Schools Catalogue
SII Chile
SMSAPI
SOAP finkok.com
Salesforce
SendGrid
Shippo
Shopify
Shopware
Shopware 6
SimpleTexting
Square
Stripe
SugarCRM
TicketBAI
TikTok Shop
Trello
Twilio
Twitter API v2
Twitter v1
UPS
UniPin
VoiceBase
Vonage
WaTrend
Walmart v3
Wasabi
WhatsApp
WiX
WooCommerce
WordPress
Xero
Yahoo Mail
Yapily
Yousign
ZATCA
Zendesk
Zoom
_Miscellaneous_
eBay
effectconnect
hacienda.go.cr

 

 

 

(Go) SugarCRM Create a Record

Submit a record to the Sugar instance using the / endpoint. In this example we are going to create an Account record with a Name of 'Test Record' and an email of 'test@sugar.com'.

For more information, see https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_7.9/Integration/Web_Services/v10/Examples/Bash/How_to_Manipulate_Records_CRUD/#Creating_a_Record

Chilkat Go Downloads

Go Package for Windows, MacOS, Linux, Alpine Linux, Solaris

    // This example assumes the Chilkat API to have been previously unlocked.
    // See Global Unlock Sample for sample code.

    http := chilkat.NewHttp()
    var success bool

    // Implements the following CURL command:

    // curl -X POST -H OAuth-Token:<access_token> -H Cache-Control:no-cache -d '{ 
    //    "name":"Test Record",
    //    "email1":"test@sugar.com"
    // }' http://<site_url>/rest/v10/Accounts

    // Use this online tool to generate code from sample JSON:
    // Generate Code to Create JSON

    // The following JSON is sent in the request body.

    // {
    //   "name": "Test Record",
    //   "email1": "test@sugar.com"
    // }

    json := chilkat.NewJsonObject()
    json.UpdateString("name","Test Record")
    json.UpdateString("email1","test@sugar.com")

    http.SetRequestHeader("Cache-Control","no-cache")
    http.SetRequestHeader("OAuth-Token","<access_token>")

    resp := http.PostJson3("http://<site_url>/rest/v10/Accounts","application/json",json)
    if http.LastMethodSuccess() == false {
        fmt.Println(http.LastErrorText())
        http.DisposeHttp()
        json.DisposeJsonObject()
        return
    }

    sbResponseBody := chilkat.NewStringBuilder()
    resp.GetBodySb(sbResponseBody)
    jResp := chilkat.NewJsonObject()
    jResp.LoadSb(sbResponseBody)
    jResp.SetEmitCompact(false)

    fmt.Println("Response Body:")
    fmt.Println(*jResp.Emit())

    respStatusCode := resp.StatusCode()
    fmt.Println("Response Status Code = ", respStatusCode)
    if respStatusCode >= 400 {
        fmt.Println("Response Header:")
        fmt.Println(resp.Header())
        fmt.Println("Failed.")
        resp.DisposeHttpResponse()
        http.DisposeHttp()
        json.DisposeJsonObject()
        sbResponseBody.DisposeStringBuilder()
        jResp.DisposeJsonObject()
        return
    }

    resp.DisposeHttpResponse()

    // Sample JSON response:
    // (Sample code for parsing the JSON response is shown below)

    // {
    //   "id": "ab2222df-73da-0e92-6887-5705428f4d68",
    //   "name": "Test Record",
    //   "date_entered": "2016-04-06T13:07:41-04:00",
    //   "date_modified": "2016-04-06T13:07:41-04:00",
    //   "modified_user_id": "1",
    //   "modified_by_name": "Administrator",
    //   "modified_user_link": {
    //     "full_name": "Administrator",
    //     "id": "1",
    //     "_acl": {
    //       "fields": [
    //       ],
    //       "delete": "no",
    //       "_hash": "8e11bf9be8f04daddee9d08d44ea891e"
    //     }
    //   },
    //   "created_by": "1",
    //   "created_by_name": "Administrator",
    //   "created_by_link": {
    //     "full_name": "Administrator",
    //     "id": "1",
    //     "_acl": {
    //       "fields": [
    //       ],
    //       "delete": "no",
    //       "_hash": "8e11bf9be8f04daddee9d08d44ea891e"
    //     }
    //   },
    //   "description": "",
    //   "deleted": false,
    //   "facebook": "",
    //   "twitter": "",
    //   "googleplus": "",
    //   "account_type": "",
    //   "industry": "",
    //   "annual_revenue": "",
    //   "phone_fax": "",
    //   "billing_address_street": "",
    //   "billing_address_street_2": "",
    //   "billing_address_street_3": "",
    //   "billing_address_street_4": "",
    //   "billing_address_city": "",
    //   "billing_address_state": "",
    //   "billing_address_postalcode": "",
    //   "billing_address_country": "",
    //   "rating": "",
    //   "phone_office": "",
    //   "phone_alternate": "",
    //   "website": "",
    //   "ownership": "",
    //   "employees": "",
    //   "ticker_symbol": "",
    //   "shipping_address_street": "",
    //   "shipping_address_street_2": "",
    //   "shipping_address_street_3": "",
    //   "shipping_address_street_4": "",
    //   "shipping_address_city": "",
    //   "shipping_address_state": "",
    //   "shipping_address_postalcode": "",
    //   "shipping_address_country": "",
    //   "parent_id": "",
    //   "sic_code": "",
    //   "duns_num": "",
    //   "parent_name": "",
    //   "member_of": {
    //     "name": "",
    //     "id": "",
    //     "_acl": {
    //       "fields": [
    //       ],
    //       "_hash": "654d337e0e912edaa00dbb0fb3dc3c17"
    //     }
    //   },
    //   "campaign_id": "",
    //   "campaign_name": "",
    //   "campaign_accounts": {
    //     "name": "",
    //     "id": "",
    //     "_acl": {
    //       "fields": [
    //       ],
    //       "_hash": "654d337e0e912edaa00dbb0fb3dc3c17"
    //     }
    //   },
    //   "following": true,
    //   "my_favorite": false,
    //   "tag": [
    //   ],
    //   "assigned_user_id": "",
    //   "assigned_user_name": "",
    //   "assigned_user_link": {
    //     "full_name": "",
    //     "id": "",
    //     "_acl": {
    //       "fields": [
    //       ],
    //       "_hash": "654d337e0e912edaa00dbb0fb3dc3c17"
    //     }
    //   },
    //   "team_count": "",
    //   "team_count_link": {
    //     "team_count": "",
    //     "id": "1",
    //     "_acl": {
    //       "fields": [
    //       ],
    //       "_hash": "654d337e0e912edaa00dbb0fb3dc3c17"
    //     }
    //   },
    //   "team_name": [
    //     {
    //       "id": 1,
    //       "name": "Global",
    //       "name_2": "",
    //       "primary": true
    //     }
    //   ],
    //   "email": [
    //     {
    //       "email_address": "test@sugar.com",
    //       "invalid_email": false,
    //       "opt_out": false,
    //       "primary_address": true,
    //       "reply_to_address": false
    //     }
    //   ],
    //   "email1": "test@sugar.com",
    //   "email2": "",
    //   "invalid_email": false,
    //   "email_opt_out": false,
    //   "email_addresses_non_primary": "",
    //   "_acl": {
    //     "fields": {}
    //   },
    //   "_module": "Accounts"
    // }

    // Sample code for parsing the JSON response...
    // Use the following online tool to generate parsing code from sample JSON:
    // Generate Parsing Code from JSON

    var id *string = new(string)
    var name *string = new(string)
    var date_entered *string = new(string)
    var date_modified *string = new(string)
modified_user_    var id *string = new(string)
    var modified_by_name *string = new(string)
modified_user_linkFull_    var name *string = new(string)
    var modified_user_linkId *string = new(string)
    var modified_user_link_aclDelete *string = new(string)
    var modified_user_link_acl_hash *string = new(string)
    var created_by *string = new(string)
    var created_by_name *string = new(string)
created_by_linkFull_    var name *string = new(string)
    var created_by_linkId *string = new(string)
    var created_by_link_aclDelete *string = new(string)
    var created_by_link_acl_hash *string = new(string)
    var description *string = new(string)
    var deleted bool
    var facebook *string = new(string)
    var twitter *string = new(string)
    var googleplus *string = new(string)
    var account_type *string = new(string)
    var industry *string = new(string)
    var annual_revenue *string = new(string)
    var phone_fax *string = new(string)
    var billing_address_street *string = new(string)
    var billing_address_street_2 *string = new(string)
    var billing_address_street_3 *string = new(string)
    var billing_address_street_4 *string = new(string)
    var billing_address_city *string = new(string)
    var billing_address_state *string = new(string)
    var billing_address_postalcode *string = new(string)
    var billing_address_country *string = new(string)
    var rating *string = new(string)
    var phone_office *string = new(string)
    var phone_alternate *string = new(string)
    var website *string = new(string)
    var ownership *string = new(string)
    var employees *string = new(string)
    var ticker_symbol *string = new(string)
    var shipping_address_street *string = new(string)
    var shipping_address_street_2 *string = new(string)
    var shipping_address_street_3 *string = new(string)
    var shipping_address_street_4 *string = new(string)
    var shipping_address_city *string = new(string)
    var shipping_address_state *string = new(string)
    var shipping_address_postalcode *string = new(string)
    var shipping_address_country *string = new(string)
parent_    var id *string = new(string)
    var sic_code *string = new(string)
    var duns_num *string = new(string)
parent_    var name *string = new(string)
    var member_ofName *string = new(string)
    var member_ofId *string = new(string)
    var member_of_acl_hash *string = new(string)
campaign_    var id *string = new(string)
    var campaign_name *string = new(string)
    var campaign_accountsName *string = new(string)
    var campaign_accountsId *string = new(string)
    var campaign_accounts_acl_hash *string = new(string)
    var following bool
    var my_favorite bool
    var assigned_user_id *string = new(string)
    var assigned_user_name *string = new(string)
assigned_user_linkFull_    var name *string = new(string)
    var assigned_user_linkId *string = new(string)
    var assigned_user_link_acl_hash *string = new(string)
    var team_count *string = new(string)
    var team_count_linkTeam_count *string = new(string)
    var team_count_linkId *string = new(string)
    var team_count_link_acl_hash *string = new(string)
    var email1 *string = new(string)
    var email2 *string = new(string)
    var invalid_email bool
    var email_opt_out bool
    var email_addresses_non_primary *string = new(string)
    var v_module *string = new(string)
    var i int
    var count_i int
    var id_int int
    var name_2 *string = new(string)
    var primary bool
    var email_address *string = new(string)
    var opt_out bool
    var primary_address bool
    var reply_to_address bool

    id = jResp.StringOf("id")
    name = jResp.StringOf("name")
    date_entered = jResp.StringOf("date_entered")
    date_modified = jResp.StringOf("date_modified")
    modified_user_id = jResp.StringOf("modified_user_id")
    modified_by_name = jResp.StringOf("modified_by_name")
    modified_user_linkFull_name = jResp.StringOf("modified_user_link.full_name")
    modified_user_linkId = jResp.StringOf("modified_user_link.id")
    modified_user_link_aclDelete = jResp.StringOf("modified_user_link._acl.delete")
    modified_user_link_acl_hash = jResp.StringOf("modified_user_link._acl._hash")
    created_by = jResp.StringOf("created_by")
    created_by_name = jResp.StringOf("created_by_name")
    created_by_linkFull_name = jResp.StringOf("created_by_link.full_name")
    created_by_linkId = jResp.StringOf("created_by_link.id")
    created_by_link_aclDelete = jResp.StringOf("created_by_link._acl.delete")
    created_by_link_acl_hash = jResp.StringOf("created_by_link._acl._hash")
    description = jResp.StringOf("description")
    deleted = jResp.BoolOf("deleted")
    facebook = jResp.StringOf("facebook")
    twitter = jResp.StringOf("twitter")
    googleplus = jResp.StringOf("googleplus")
    account_type = jResp.StringOf("account_type")
    industry = jResp.StringOf("industry")
    annual_revenue = jResp.StringOf("annual_revenue")
    phone_fax = jResp.StringOf("phone_fax")
    billing_address_street = jResp.StringOf("billing_address_street")
    billing_address_street_2 = jResp.StringOf("billing_address_street_2")
    billing_address_street_3 = jResp.StringOf("billing_address_street_3")
    billing_address_street_4 = jResp.StringOf("billing_address_street_4")
    billing_address_city = jResp.StringOf("billing_address_city")
    billing_address_state = jResp.StringOf("billing_address_state")
    billing_address_postalcode = jResp.StringOf("billing_address_postalcode")
    billing_address_country = jResp.StringOf("billing_address_country")
    rating = jResp.StringOf("rating")
    phone_office = jResp.StringOf("phone_office")
    phone_alternate = jResp.StringOf("phone_alternate")
    website = jResp.StringOf("website")
    ownership = jResp.StringOf("ownership")
    employees = jResp.StringOf("employees")
    ticker_symbol = jResp.StringOf("ticker_symbol")
    shipping_address_street = jResp.StringOf("shipping_address_street")
    shipping_address_street_2 = jResp.StringOf("shipping_address_street_2")
    shipping_address_street_3 = jResp.StringOf("shipping_address_street_3")
    shipping_address_street_4 = jResp.StringOf("shipping_address_street_4")
    shipping_address_city = jResp.StringOf("shipping_address_city")
    shipping_address_state = jResp.StringOf("shipping_address_state")
    shipping_address_postalcode = jResp.StringOf("shipping_address_postalcode")
    shipping_address_country = jResp.StringOf("shipping_address_country")
    parent_id = jResp.StringOf("parent_id")
    sic_code = jResp.StringOf("sic_code")
    duns_num = jResp.StringOf("duns_num")
    parent_name = jResp.StringOf("parent_name")
    member_ofName = jResp.StringOf("member_of.name")
    member_ofId = jResp.StringOf("member_of.id")
    member_of_acl_hash = jResp.StringOf("member_of._acl._hash")
    campaign_id = jResp.StringOf("campaign_id")
    campaign_name = jResp.StringOf("campaign_name")
    campaign_accountsName = jResp.StringOf("campaign_accounts.name")
    campaign_accountsId = jResp.StringOf("campaign_accounts.id")
    campaign_accounts_acl_hash = jResp.StringOf("campaign_accounts._acl._hash")
    following = jResp.BoolOf("following")
    my_favorite = jResp.BoolOf("my_favorite")
    assigned_user_id = jResp.StringOf("assigned_user_id")
    assigned_user_name = jResp.StringOf("assigned_user_name")
    assigned_user_linkFull_name = jResp.StringOf("assigned_user_link.full_name")
    assigned_user_linkId = jResp.StringOf("assigned_user_link.id")
    assigned_user_link_acl_hash = jResp.StringOf("assigned_user_link._acl._hash")
    team_count = jResp.StringOf("team_count")
    team_count_linkTeam_count = jResp.StringOf("team_count_link.team_count")
    team_count_linkId = jResp.StringOf("team_count_link.id")
    team_count_link_acl_hash = jResp.StringOf("team_count_link._acl._hash")
    email1 = jResp.StringOf("email1")
    email2 = jResp.StringOf("email2")
    invalid_email = jResp.BoolOf("invalid_email")
    email_opt_out = jResp.BoolOf("email_opt_out")
    email_addresses_non_primary = jResp.StringOf("email_addresses_non_primary")
    v_module = jResp.StringOf("_module")
    i = 0
    count_i = jResp.SizeOfArray("modified_user_link._acl.fields")
    for i < count_i {
        jResp.SetI(i)
        i = i + 1
    }

    i = 0
    count_i = jResp.SizeOfArray("created_by_link._acl.fields")
    for i < count_i {
        jResp.SetI(i)
        i = i + 1
    }

    i = 0
    count_i = jResp.SizeOfArray("member_of._acl.fields")
    for i < count_i {
        jResp.SetI(i)
        i = i + 1
    }

    i = 0
    count_i = jResp.SizeOfArray("campaign_accounts._acl.fields")
    for i < count_i {
        jResp.SetI(i)
        i = i + 1
    }

    i = 0
    count_i = jResp.SizeOfArray("tag")
    for i < count_i {
        jResp.SetI(i)
        i = i + 1
    }

    i = 0
    count_i = jResp.SizeOfArray("assigned_user_link._acl.fields")
    for i < count_i {
        jResp.SetI(i)
        i = i + 1
    }

    i = 0
    count_i = jResp.SizeOfArray("team_count_link._acl.fields")
    for i < count_i {
        jResp.SetI(i)
        i = i + 1
    }

    i = 0
    count_i = jResp.SizeOfArray("team_name")
    for i < count_i {
        jResp.SetI(i)
        id_int = jResp.IntOf("team_name[i].id")
        name = jResp.StringOf("team_name[i].name")
        name_2 = jResp.StringOf("team_name[i].name_2")
        primary = jResp.BoolOf("team_name[i].primary")
        i = i + 1
    }

    i = 0
    count_i = jResp.SizeOfArray("email")
    for i < count_i {
        jResp.SetI(i)
        email_address = jResp.StringOf("email[i].email_address")
        invalid_email = jResp.BoolOf("email[i].invalid_email")
        opt_out = jResp.BoolOf("email[i].opt_out")
        primary_address = jResp.BoolOf("email[i].primary_address")
        reply_to_address = jResp.BoolOf("email[i].reply_to_address")
        i = i + 1
    }


    http.DisposeHttp()
    json.DisposeJsonObject()
    sbResponseBody.DisposeStringBuilder()
    jResp.DisposeJsonObject()

 

© 2000-2024 Chilkat Software, Inc. All Rights Reserved.