The following methods operate on the Product Survey Results data model.

GET https://api.cratejoy.com/v1/product_survey_results/
GET https://api.cratejoy.com/v1/product_survey_results/{result_id}/
POST https://api.cratejoy.com/v1/product_survey_results/
DELETE https://api.cratejoy.com/v1/product_survey_results/{result_id}/

List product survey results

GET http://api.cratejoy.com/v1/product_survey_results/
$.get('https://api.cratejoy.com/v1/product_survey_results/');
$.get('https://api.cratejoy.com/v1/product_survey_results/?&limit=1&page=1&subscription_id=262294062');
{
  "count": 1,
  "next": null,
  "prev": null,
  "results": [
    {
      "answers": [
        {
          "field": {
            "id": 262290128,
            "name": "What's your favorite color?",
            "survey": {
              "id": 262290126,
              "type": "product_survey"
            },
            "survey_id": 262290126,
            "type": "product_survey_field"
          },
          "field_id": 262290128,
          "id": 262294081,
          "value": "My favorite color is red."
        }
      ],
      "created_at": "Thu, 14 Apr 2016 19:44:35 GMT",
      "id": 262294080,
      "subscription_id": 262294062,
      "type": "product_survey_result",
      "updated_at": "Thu, 14 Apr 2016 19:44:35 GMT",
      "url": "/v1/product_survey_results/262294080/"
    }
  ]
}

See Product Survey Results documentation for a complete list of filters and relationships.

Get product survey result

GET https://api.cratejoy.com/v1/product_survey_results/{result_id}/
$.get('https://api.cratejoy.com/v1/product_survey_results/262294080/');

Pulls the results with a given ID.

{
  "answers": [
    {
      "field": {
        "id": 262290129,
        "name": "What's your favorite color?",
        "survey": {
          "id": 262290126,
          "type": "product_survey"
        },
        "survey_id": 262290126,
        "type": "product_survey_field"
      },
      "field_id": 262290128,
      "id": 262294081,
      "value": "My favorite color is red."
    }
  ],
  "created_at": "Thu, 28 Jul 2016 16:39:45 GMT",
  "id": 384625777,
  "subscription_id": 384625744,
  "type": "product_survey_result",
  "updated_at": "Thu, 28 Jul 2016 16:39:45 GMT"
}

Add product survey result

POST https://api.cratejoy.com/v1/product_survey_results//
$.ajax({
    url: 'https://api.cratejoy.com/v1/product_survey_results/',
    method: 'PUT',
    data: {
        subscription_id: 384625744,
        survey_id: 262290126,
        answers: {
					262290128: "My favorite color is red."
        }
    },
});

Adds survey answers for a given subscription ID and survey ID. "answers" keys should be field IDs.

{
  "answers": [
    {
      "field": {
        "id": 262290128,
        "name": "What's your favorite color?",
        "survey": {
          "id": 262290126,
          "type": "product_survey"
        },
        "survey_id": 262290126,
        "type": "product_survey_field"
      },
      "field_id": 262290128,
      "id": 3810941911,
      "value": "My favorite color is red."
    }
  ],
  "created_at": "Wed, 23 Jun 2021 06:05:28 GMT",
  "id": 3810941910,
  "subscription_id": 384625744,
  "type": "product_survey_result",
  "updated_at": "Wed, 23 Jun 2021 06:05:28 GMT"
}

Delete product survey result

DELETE https://api.cratejoy.com/v1/product_survey_results/{result_id}/
$.ajax({
    url: 'https://api.cratejoy.com/v1/product_survey_results/3810941910/',
    method: 'DELETE',
});