Let the platform do the work

How to Unfavorite a Record

Overview

An example in bash script demonstrating how to unfavorite a record using the v11 /<module>/:record/unfavorite REST PUT endpoint.

Unfavoriting a Record

Authenticating

First, you will need to authenticate to the Sugar API. An example is shown below:

  curl -X POST -H Cache-Control:no-cache -H "Content-Type: application/json" -d '{ 
 "grant_type":"password",
 "client_id":"sugar",
 "client_secret":"",
 "username":"admin",
 "password":"password",
 "platform":"custom_api"
}' https://{site_url}/rest/v11/oauth2/token

More information on authenticating can be found in the How to Authenticate and Log Out example and /oauth2/logout endpoint documentation.

Unfavoriting a Record

Next, we can unfavorite a specific record using the /<module>/:record/unfavorite endpoint.

  curl -s -X PUT -H OAuth-Token:{access_token} -H Cache-Control:no-cache https://{site_url}/rest/v11/Accounts/ae8b1783-404a-fcb8-1e1e-56f1cc52cd1a/unfavorite

More information on the unfavorite API can be found in the /<module>/:record/unfavorite PUT documentation.

Response

The data received from the server is shown below:

  {
    "id": "ae8b1783-404a-fcb8-1e1e-56f1cc52cd1a",
    "name": "Union Bank",
    "date_entered": "2016-03-22T17:49:50-05:00",
    "date_modified": "2016-03-30T17:44:20-05: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": "Customer",
    "industry": "Banking",
    "annual_revenue": "",
    "phone_fax": "",
    "billing_address_street": "67321 West Siam St.",
    "billing_address_street_2": "",
    "billing_address_street_3": "",
    "billing_address_street_4": "",
    "billing_address_city": "Ohio",
    "billing_address_state": "CA",
    "billing_address_postalcode": "25159",
    "billing_address_country": "USA",
    "rating": "",
    "phone_office": "(065) 489-6104",
    "phone_alternate": "",
    "website": "www.qahr.edu",
    "ownership": "",
    "employees": "",
    "ticker_symbol": "",
    "shipping_address_street": "67321 West Siam St.",
    "shipping_address_street_2": "",
    "shipping_address_street_3": "",
    "shipping_address_street_4": "",
    "shipping_address_city": "Ohio",
    "shipping_address_state": "CA",
    "shipping_address_postalcode": "25159",
    "shipping_address_country": "USA",
    "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": "seed_sarah_id",
    "assigned_user_name": "Sarah Smith",
    "assigned_user_link": {
        "full_name": "Sarah Smith",
        "id": "seed_sarah_id",
        "_acl": {
            "fields": [],
            "_hash": "654d337e0e912edaa00dbb0fb3dc3c17"
        }
    },
    "team_count": "",
    "team_count_link": {
        "team_count": "",
        "id": "West",
        "_acl": {
            "fields": [],
            "_hash": "654d337e0e912edaa00dbb0fb3dc3c17"
        }
    },
    "team_name": [{
        "id": "East",
        "name": "East",
        "name_2": "",
        "primary": false
    }, {
        "id": 1,
        "name": "Global",
        "name_2": "",
        "primary": false
    }, {
        "id": "West",
        "name": "West",
        "name_2": "",
        "primary": true
    }],
    "email": [{
        "email_address": "hr.support.kid@example.info",
        "invalid_email": false,
        "opt_out": false,
        "primary_address": true,
        "reply_to_address": false
    }, {
        "email_address": "info.support.the@example.com",
        "invalid_email": false,
        "opt_out": false,
        "primary_address": false,
        "reply_to_address": false
    }],
    "email1": "hr.support.kid@example.info",
    "email2": "info.support.the@example.com",
    "invalid_email": false,
    "email_opt_out": false,
    "email_addresses_non_primary": "",
    "_acl": {
        "fields": {}
    },
    "_module": "Accounts"
}