Skip to content

Case Study (how to start - examples)

Prerequisite

  • This examples will use basic curl commands
  • I will ommit most of repeative parts of curl commands (only explain them once)
  • Examples are designed for SMB users not Getresponse360

Curl

bash
curl -H "X-Auth-Token: api-key 5377d45b66c6dd2540c3887e957fe999" https://api.getresponse.com/v3/accounts
  • -H is a flag that allows to send Header with request. I use it to send my api-key. It is mandatory header for EVERY request.
  • Second parameter is a request URL.
  • For post request you must use flag -d with content of a post body after that.
  • For delete request you must use -X DELETE flag.
  • In next examples i will omit -H “X-Auth-Token” header

Basic actions

Update you account information

I want to update my profile info. First let me see how this profile resource looks like…

bash
curl https://api.getresponse.com/v3/accounts

Response

json
{
    "accountId": "aJYH",
    "firstName": "John",
    "lastName": "Smith",
    "email": "john.smith@example.com",
    "phone": "+485835148754",
    "companyName": "LoveMyHardware",
    "state": "Pomorskie",
    "city": "Gdansk",
    "zipCode": "80-300",
    "countryCode": {
        "countryCodeId": "175"
    },
    "industryTag": {
        "industryTagId": null
    },
    "numberOfEmployees": "500",
    "timeFormat": "24h",
    "href": "http://api.getresponse.com/v3/account/aJYH"
}

Hmm, it looks ok, but i want to change my phone

Update postal information

bash
curl https://api.getresponse.com/v3/accounts -d '
{
    "phone": "+485865430923",
}
'

Ok, that's done, now i need to add some nice from-fields for my emails.

Add from-fields

First I want to look at existing from-fields.

bash
curl https://api.getresponse.com/v3/from-fields

Response

json
[
    {
        "fromFieldId": "ufIK",
        "email": "john.smith@example.com",
        "name": "John Smith",
        "isActive": "true",
        "isDefault": "true",
        "createdOn": "2014-06-16T09:07:09+0000",
        "activatedOn": null,
        "href": "http://api.getresponse.com/v3/from-fields/ufIK"
    }
]

Ok, I want to sends email to my future subscribers using the same email address but different “name” to appear in “from” field 😃. I decided to create two, one for PC users and one for Mac’s.

Mac

bash
curl http://api.getresponse.com/v3/from-fields -d '
{
"email": "john.smith@example.com",
"name": "John 'ILoveMac' Smith"
}
'

PC

bash
curl http://api.getresponse.com/v3/from-fields -d '
{
"email": "john.smith@example.com",
"name": "John 'ILovePC' Smith"
}
'

I’ve created my new from-fields waited for confirmation emails and when the arrive, I’ve confirmed them and now they are active.

Add custom-fields

Ok, now it’s time for some custom fields. I want to “categorize” my subscribers based on some property I’ve defined. I have some ideas what to do with them later…

ComputerType

bash
curl http://api.getresponse.com/v3/custom-fields -d '
{
    "name": "OperatingSystem",
    "type": "radio",
    "hidden": "false",
    "values": [
        "Win",
        "OsX",
        "Linux"
    ]
}
'

OperatingSystem

bash
curl http://api.getresponse.com/v3/custom-fields -d '
{
    "name": "OperatingSystem",
    "type": "radio",
    "hidden": "false",
    "values": [
        "Win",
        "OsX",
        "Linux"
    ]
}
'

VipStatus

Last but not least I want to set certain subscribers as a “VIP”. This will be manual process, and i don’t want to subscribers changes this custom-field. This should be hidden.

bash
curl http://api.getresponse.com/v3/custom-fields -d '
{
    "name": "VipStatus",
    "type": "radio",
    "hidden": "true",
    "values": [
        "Yes",
        "No"
    ]
}
'

Now my custom-field list looks like that:

json
[
    {
        "customFieldId": "JK",
        "href": "http://api.getresponse.new/v3/custom-fields/JK",
        "name": "ComputerType",
        "type": "radio",
        "hidden": "false",
        "values": [
            "Mac",
            "PC"
        ]
    },
    {
        "customFieldId": "eN",
        "href": "http://api.getresponse.new/v3/custom-fields/eN",
        "name": "OperatingSystem",
        "type": "radio",
        "hidden": "false",
        "values": [
            "Linux",
            "OsX",
            "Win"
        ]
    },
    {
        "customFieldId": "SP",
        "href": "http://api.getresponse.new/v3/custom-fields/SP",
        "name": "VipStatus",
        "type": "radio",
        "hidden": "true",
        "values": [
            "No",
            "Yes"
        ]
    }
]