Coder Social home page Coder Social logo

surveymonkey-v3-api-php's People

Contributors

altrozero avatar arisanguinetti avatar bernardpeh avatar darrylhein avatar ghassani avatar intrepidws avatar nicolasarchila avatar noellh avatar shoaibali avatar strixy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

surveymonkey-v3-api-php's Issues

filter responses from weblink collector by custom_variable

I have created a survey on Survey Monkey. And added a custom variable. The collector is a weblink appending the custom variable to it.

I want to check if a user has completed the survey or not. If someone has completed the survey then they are redirected to the homepage and if not then they are redirected to the survey page. I'm passing the CustomerID in my redirect if users have not completed the survey.

I want to be able to check if this CustomerID is in the list of responses. I'm able to get the bulk responses in my Get request But is there a way I can just check directly if this CustomerID exists in my completed list. Bulk Request: https://api.surveymonkey.net/v3/surveys/1234/responses/bulk

Fetching "next" pages has no API method

Often the Surveymonkey API returns a "next" field.
The API does however not provide a method to call the "next" URL.

For example, I want to get all survey responses, in few requests. Using get Collector/bulk with details allows to get a max of 100 responses through the api. The Result set could provide a "getNext()" method, that fetches the next 100 responses.

`createWebhook()` with `object_ids` is serialised incorrectly

Thanks for this lib, it's looking promising for my use case so far!

I would create a PR for this but I'm not yet 100% clear on the best way to resolve it.

The behaviour I expected was that I could pass object_ids as a key of the array passed to createWebhook() and have it passed on in the request object like

{
...
object_ids: ["1234"]
...
}

But because Client::createRequest() does the encoding from the input array and adds the JSON_FORCE_OBJECT flag, the current behaviour seems to be this:

{
...
object_ids: {"0": "1234"}
...
}

This is rejected by the API with an invalid schema error.

One workaround is to do my own json_encode() without the flag and pass in the string, but this generates a warning since the public method declares its argument as an array. (I'm still on PHP 5.6 for this project unfortunately - haven't checked what happens on 7.x yet.)

As things stand, I don't think it's possible to pass in the correct param type while setting this filter for the new webhook successfully.

If you don't see obvious BC breaks for other methods, I'm thinking the cleanest solution might be:

  • cast createWebhook()'s array $data param to an object with (object) - leaving any nested arrays and objects untouched with their original types
  • do the equivalent for any other methods that currently rely on the JSON force object flag's type conversion
  • remove the JSON_FORCE_OBJECT flag from Client::createRequest() when encoding array inputs

What do you think?

SM client requests get 403 with empty json body

It appears that on 5/23, SM moved their platform to AWS Cloudfront which rejects requests that have an empty json body. My application uses SM webhooks to get notified that a new response is ready to download. We download survey responses many times per day. Our application started getting the 403s and returned false getData() calls around the same time. I submitted a support ticket to SM and got the attached response.

For some reason SM also change our access_token.

I changed Client.php, updated our access code and tested and all was ok. I will follow up with a pull request for review. Here is my attempt at a revised function.

private function createRequest($method, $uri, array $options = [], $body = null)
    {

        /* 
            Survey Monkey moved to CloudFront on 2020-05-23
            CloudFront issues 403 Forbidden with empty json body
        */    
        $ret = new Request($method, $uri, []);

        if (is_array($body)) {
            $bodyString = json_encode($body);
        }

        if (isset($options['query'])) {
            $uri = $ret->getUri()->withQuery(is_array($options['query']) ? http_build_query($options['query']) : $options['query']);
            return $ret->withUri($uri, true);
        }

        return $ret;
    }

Annotation 2020-06-06 104503

per_page parameters are not transferred

$options = ['per_page'=> 200];
$results = $client->getSurveys($options);

When calling the getSurveys method of the Client the options seem to be completely ignored.

Not compatible with guzzlehttp/guzzle 6.4

Hello !
On the last tag (1.0.2), the method src/Api/ResponsesTrait.php::getSurveyResponse doesn't work anymore since i upgraded package guzzlehttp/guzzle from 6.2 to 6.4 (this exception is thrown : "Header value can not be an empty array.").
It's working fine on master though, so can you make a tag please ? (i have to set a commit in composer now)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.