Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add some contacts API methods #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 35 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ All methods return an array containing a **success** boolean, and the **data** -
Advanced
----
```
$SM = new SurveyMonkey("myApiKey" , "myAccessToken",
$SM = new SurveyMonkey("myApiKey" , "myAccessToken",
array( // Override default API options (quite useless at the moment)
'protocol' => 'http', // will not work.. they require SSL
'hostname' => 'fake-api.surveymonkey.net' // will also not work..
),
),
array( // CURL override options
CURLOPT_SSL_VERIFYPEER => false // Better add cacert.pam, no?
// ...<Any CURLOPT>...
Expand Down Expand Up @@ -75,6 +75,39 @@ public function getSurveyDetails($surveyId, $params = array()){}
public function getCollectorList($surveyId, $params = array()){}
```

**getContacts**
```
/**
* Returns a list of contacts
* @see https://developer.surveymonkey.com/api/v3/#contacts-and-contact-lists
* @param array $params optional request array
* @return array Results
*/
public function getContacts($params = array()){}
```

**getContactDetails**
```
/**
* Gets the details for a contact
* @see https://developer.surveymonkey.com/api/v3/#contacts-and-contact-lists
* @param string $contactId Contact ID
* @return array Result
*/
public function getContactDetails($contactId){}
```

**deleteContact**
```
/**
* Deletes a contact
* @see https://developer.surveymonkey.com/api/v3/#contacts-and-contact-lists
* @param string $contactId Contact ID
* @return array Result
*/
public function deleteContact($contactId){}
```

**getRespondentList**
```
/**
Expand Down
33 changes: 33 additions & 0 deletions lib/SurveyMonkey.php
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,39 @@ public function getCollectorList($surveyId, $params = array())
{
return $this->run('surveys/' . $surveyId . '/collectors', $params, 'GET');
}

/**
* Returns a list of contacts
* @see https://developer.surveymonkey.com/api/v3/#contacts-and-contact-lists
* @param array $params optional request array
* @return array Results
*/
public function getContacts($params = array())
{
return $this->run('contacts', $params, "GET");
}

/**
* Gets the details for a contact
* @see https://developer.surveymonkey.com/api/v3/#contacts-and-contact-lists
* @param string $contactId Contact ID
* @return array Result
*/
public function getContactDetails($contactId)
{
return $this->run('contacts/' . $contactId, array(), "GET");
}

/**
* Deletes a contact
* @see https://developer.surveymonkey.com/api/v3/#contacts-and-contact-lists
* @param string $contactId Contact ID
* @return array Result
*/
public function deleteContact($contactId)
{
return $this->run('contacts/' . $contactId, array(), "DELETE");
}
}

/**
Expand Down