Skip to content

Instantly share code, notes, and snippets.

@dangerouse
Created December 11, 2015 17:37
Show Gist options
  • Save dangerouse/67986c2a718d2f5c46af to your computer and use it in GitHub Desktop.
Save dangerouse/67986c2a718d2f5c46af to your computer and use it in GitHub Desktop.
CloudSponge API - Generic CSV import example

Step 1: Begin Import

~ $ curl -u [user_info] -d "" "https://api.cloudsponge.com/begin_import/user_consent?service=csv"
{
    "echo": null,
    "id": 82261119,
    "import_id": 82261119,
    "import_type": "CSV",
    "status": "success",
    "url": "https://api.cloudsponge.com/csv/RW3C2BC",
    "user_id": null
}

Step 2: Show the CSV Upload Form

~ $ open https://api.cloudsponge.com/csv/RW3C2BC

Step 3: Wait for the import to complete

~ $ curl -u [user_info] "https://api.cloudsponge.com/events/82261119"
{
    "events": [
        {
            "created_at": "2015-12-11T09:02:46.000-08:00",
            "description": null,
            "event_type": "INITIALIZING",
            "import_action_id": 82261119,
            "import_id": 82261119,
            "status": "INPROGRESS",
            "value": 0
        }
    ],
    "id": 82261119,
    "import_id": 82261119,
    "user_id": null
}
~ $ curl -u [user_info] "https://api.cloudsponge.com/events/82261119"
{
    "events": [
        {
            "created_at": "2015-12-11T09:02:46.000-08:00",
            "description": null,
            "event_type": "INITIALIZING",
            "import_action_id": 82261119,
            "import_id": 82261119,
            "status": "COMPLETED",
            "value": 0
        },
        {
            "created_at": "2015-12-11T09:05:28.000-08:00",
            "description": null,
            "event_type": "GATHERING",
            "import_action_id": 82261119,
            "import_id": 82261119,
            "status": "COMPLETED",
            "value": 4
        },
        {
            "created_at": "2015-12-11T09:05:28.000-08:00",
            "description": null,
            "event_type": "COMPLETE",
            "import_action_id": 82261119,
            "import_id": 82261119,
            "status": "COMPLETED",
            "value": 0
        }
    ],
    "id": 82261119,
    "import_id": 82261119,
    "user_id": null
}

Step 4: Get contacts

~ $ curl -u [user_info] "https://api.cloudsponge.com/contacts/82261119"
{
    "contacts": [
        {
            "address": [],
            "companies": [],
            "email": [
                {
                    "address": "[email protected]",
                    "type": "E-mail Address"
                }
            ],
            "first_name": "Graeme",
            "groups": [],
            "last_name": "Rouse",
            "locations": [],
            "phone": [],
            "photos": []
        },
        {
            "address": [],
            "companies": [],
            "email": [
                {
                    "address": "[email protected]",
                    "type": "E-mail Address"
                }
            ],
            "first_name": "Jay",
            "groups": [],
            "last_name": "Gibb",
            "locations": [],
            "phone": [],
            "photos": []
        }
    ],
    "contacts_owner": null,
    "count": 2,
    "echo": null,
    "id": 82261119,
    "import_id": 82261119,
    "start": 0,
    "total": 2,
    "user_id": null
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment