NAV Navbar
cURL Rails php
  • Introduction
  • Authentication
  • Conventions
  • Google Star Ratings
  • API V1 Reference
  • Easy API V1 Reference
  • Introduction

    Welcome to the Diduenjoy API official documentation!

    The Diduenjoy API is organized around REST and JSON API. Our API is designed to have predictable, resource-oriented URLs and to use HTTP response codes to indicate API errors. We use built-in HTTP features, like HTTP authentication and HTTP verbs, which can be understood by off-the-shelf HTTP clients, and we support cross-origin resource sharing to allow you to interact securely with our API from a client-side web application (though you should remember that you should never expose your secret API key in any public website's client-side code). JSON will be returned in all responses from the API, including errors.

    You can view code examples and snippets in different programming language in the right frame and switch between them with the top right tabs.

    This API documentation was created by Diduenjoy. Feel free to submit us some improvements such as new suported languages or corrections.

    Authentication

    Get an API key

    You SHALL authenticate to the Diduenjoy API by providing your secret API key in the request. Your API keys carry many privileges, so be sure to keep them secret!

    You can find and generate your API keys in the Settings>API page in your diduenjoy dashboard.

    api_key_section_2

    If you dont have any generated Api key you can create a new one with the + Generate a new API key button.

    api_key_section

    Auth with API key

    Authentication to the API occurs via HTTP Basic Auth. Provide your API key as the basic auth username. You do not need to provide a password.

    Example request

    require 'net/http'
    require 'net/https'
    require 'uri'
    
    uri = URI('https://api.diduenjoy.com/api/v1/companies')
    
    Net::HTTP.start(uri.host, uri.port,
      :use_ssl => uri.scheme == 'https',
      :verify_mode => OpenSSL::SSL::VERIFY_NONE) do |http|
    
      request = Net::HTTP::Get.new uri.request_uri
      # keep empty second params
      request.basic_auth 'API_KEY', ''
    
      response = http.request request # Net::HTTPResponse object
    
    end
    
    curl 'https://api.diduenjoy.com/api/v1/companies' \
     -u 'API_KEY:'
    

    Diduenjoy expects all API requests to have the Base64 encoded API key in the Authorization header Authorization: Basic BASE64_API_KEY

    Conventions

    The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119 [RFC2119].

    Google Star Ratings

    In the Google search engine, star ratings can appear bellow the results.

    client_docs-google_rating-example

    To get a similar result, you SHALL have to gather reviews and add an html snippet to your website.

    Getting started

    4 Actors

    The workflow

    1. Customers buy items from the merchant
    2. The merchant notifies Diduenjoy about the transaction
    3. Diduenjoy sends surveys to the customers
    4. Customers answer to the Diduenjoy surveys
    5. The merchant fetch the data gathered by Diduenjoy and updates his items or categories webpages metadata
    6. Google crawls the merchant website and update the search results stars according to the webpages metadata

    The metadata snippet

    <html>
      <head>
        <title>Page of my awesome Product</title>
      </head>
      <body>
        <!-- ... -->
        <script type="application/ld+json">
          {
            "@context": "http://schema.org/",
            "@type": "Product",
            "name": "awesomeProduct",
            "image": "http://www.adress.of.awesomeProduct.image.jpeg",
            "description": "My awesomeProduct desc which appears in the google search",
            "brand": "AwesomeCompany",
            "aggregateRating": {
              "@type": "AggregateRating",
              "ratingValue": "8.1",
              "bestRating" : "10",
              "reviewCount": "42"
            }
          }
        </script>
        <!-- ... -->
      </body>
    </html>
    

    Here is an example of data you need to place in a product html page in order to see related note on google search result for this product.

    You should keep in mind that if you put more than one script per page, the behaviour might become unpredictable. Indeed, if your page has many products (ex: multiple blue shoes)the google search will appears such as, all ratings will be displayed together. However, you can decide if either or not you want this particular behaviour.

    The most important data that MUST be replaced here is aggregateRating.
    Luckily, diduenjoy provides an endpoint to give you dynamicaly the related rating of your product page collected through your feedbacks!
    Of course you need to replace other fields like name, image, description, brand and eventually @type.
    Check it out this example to apply this to your own pages!

    Script structure

    <html>
      <body>
        <!-- ...  -->
        <script type="application/ld+json">
          {
            "@context": "http://schema.org/",
            "@type": "Product",
            "name": "Raposce scissors 16 cm",
            "image": "https://mysite.images_api/products/raposce_ciseaux_16.jpeg",
            "description": "Precision-Sharpened Blades for Smooth Cutting Action with 16 cm blades.",
            "brand": "Raposce",
            "aggregateRating": {
              "@type": "AggregateRating",
              "ratingValue": "8.1",
              "bestRating" : "10",
              "reviewCount": "42"
            }
          }
        </script>
      </body>
    </html>
    
    key                     value
    @context Constant String, required

    Let its value to http://schema.org/
    @type String, required

    SHALL be here [http://schema.org/docs/full.html].You SHALL mainly use Product and SomeProducts (group of products)
    name String, required

    The name of your product
    image String, recommended

    The url of your product's image
    description String, recommended

    The description of your product
    brand String, recommended

    Your Brand name
    aggregateRating JsonObject, required

    The data which gives your product rating to Google. Provided by this diduenjoy enpoint

    Diduenjoy aggregate rating endpoint

    This provided endpoint is used to retrieve the JsonObject and needs to be inserted into your script in front of the "aggregateRating" key. It takes one optional (but recommended) parameter named Filter. If none is given, the enpoint will give you the ratings gathered through ALL your feedbacks (and not on one specific product except if you only sell this particular product).

    Filter

    Filter param may have 2 keys, which means you can retrieve the rating of your product(s) with 2 filters that are surveys and segments

    Surveys

    The surveys filter is an array of the surveys you use to collect feedbacks on this particular product(s).

    Segments

    The segments filter is an object of keys/array. * The key should be the name of the segment you want to filter by: for instance Color, ProductName or ProductId * The array should contains a list of values to filter by such as ['red', 'green'], ['Camambert Fermier 1 an'], or ['123456']

    Url

    The url of this enpoint is the following : https://api.diduenjoy.com/api/v3/aggregate-ratings

    All in

    require 'net/http'
    
    DIDUENJOY_API_KEY = '28b22313-bb59-4f78-8bf2-911e7d7aba4b'
    ENDPOINT_URL = 'https://api.diduenjoy.com/api/v3/aggregate-ratings'
    params = {
      "filter": {
        "surveys": [
          "ef053beb-8dbb-4cc1-88dd-4ea4fbfc236e",
          "515d627e-1dd4-41ca-ba12-41b2db5268a5"
        ],
        "segments": {
          "ProductName" : ["Sonline 10pcs 20mm"],
          "color": ["silver"]
        }
      }
    }
    
    uri = URI.parse(ENDPOINT_URL)
    request = Net::HTTP::Post.new(uri)
    request.basic_auth(DIDUENJOY_API_KEY, '') # empty string is important
    request.set_form_data(params)
    
    response = Net::HTTP.start(uri.hostname, uri.port) do |http|
      http.request(request)
    end
    
    @aggregate_rating = response.body if response.is_a?(Net::HTTPSuccess)
    

    Now, if you want to retrieve ratings for feedbacks sent through 2 surveys filtered by 2 segments with values such as the ones given:

    Test it

    Once you have dynamicaly (or not) generated these scripts and retrieved related datas, you should test your scripts content to check if its content is valid. You can perform this easily :
    - go to this google page.
    - choose code blockgoogle_star_test
    - paste all your html product(s) page and click on test
    - you should see something like that : google_star_test_1

    It will return an aggregate rating corresponding to the average of your filtered feedbacks.

    Notify Google something changed!

    Once in production, you SHALL notify Google that something changed on your website and it will crawl your data to update the google search results related to your product(s) pages and update your sitemaps.

    To achieve the following, go to Google webmasters tools
    Then go to the crawl folder, in Sitemaps section webtool1
    Finaly, click on add/test sitemaps and click on submit. webtool2

    Google Star Concrete Example

    controllers/glasses_controller.rb

    class GlassesController
    # ...
    
      ENDPOINT_URL = 'https://api.diduenjoy.com/api/v3/aggregate-ratings'
    
      def get_diduenjoy_aggregate(filters)
        uri = URI.parse(ENDPOINT_URL)
        request = Net::HTTP::Post.new(uri)
        request.basic_auth(DIDUENJOY_API_KEY, '') # empty string is important
        request.set_form_data(params)
    
        response = Net::HTTP.start(uri.hostname, uri.port) do |http|
          http.request(request)
        end
    
        response.body if response.is_a?(Net::HTTPSuccess)
      end
    

    glasses/show.html.erb

    <script type="application/ld+json">
      {
        "@context": "http://schema.org/",
        "@type": "Product",
        "name": @glasses.name,
        "image": @glasses.img,
        "description": @glasses.description,
        "brand": "Glasses Inc.",
        "aggregateRating": @aggregate_rating_content
      }
    </script>
    

    glasses/index.html.erb

    <script type="application/ld+json">
      {
        "@context": "http://schema.org/",
        "@type": "SomeProducts",
        "name": "Glasses Inc branded glasses",
        "image": Glasses.global_image,
        "description": @desc,
        "brand": "Glasses Inc.",
        "aggregateRating": @aggregate_rating_index_content
      }
    </script>
    
    # check ruby tab
    
    // check ruby tab
    

    This example provides how to add aggregate ratings to a shop.

    Here is an example :

    In order to have the ratings displayed, the company SHALL add the aggregate function to all its pages so when a user searches on Google, the following occurs:

      # params[:filters] with like :
      # - { colors => ['blue'] }
      # - { shapes => ['square'], colors: ['red', 'green'] }
      def index
        filters = params[:filters]
        @glasses = apply_filters(Glasses.all, filters)
        due_fiter = {
          "filter": {
            "surveys": [SURVEY_ID],
            "segments" : {
              "color": filters['colors'],
              "shape": filters['shapes']
            }
          }
        }
        @aggregate_rating_index_content = get_diduenjoy_aggregate(due_fiter)
        @desc = "Glasses of many shapes and colors" # you can custom it with your filters
    
        render :index
      end
    
      def show
        id = params[:id]
        @glasses = Glasses.find(id)
        due_filter = {
          "filter": {
            "surveys": [SURVEY_ID],
            "segments": {
              "internal_id": @glasses.id
            }
          }
        }
        @aggregate_rating_show_content = get_diduenjoy_aggregate(due_filter)
    
        render :show
      end
    
    # check ruby tab
    
    // check ruby tab
    

    First of all, you SHALL define how to use your filters param to extract the appropriate filters to query Diduenjoy API. In this present case, if we are on an index page filtered (or not) by shape and color, you MAY use them to query related feedbacks average. Therefore, if you are on a single product page, you MUST use the product id to get it. You SHALL get the result into an @aggregate_rating_content var instead of using it into our html.erb file. Additionally, you SHOULD assume that they are partial views (so body and html tags always encapsulate show and index views).

    API V1 Reference

    Optional parameters for pagination (filters)

    To handle pagination, you can add two parameters to your request.

    parameter description
    page[size]
    integer
    number of returned items per page
    default: 25
    page[number]
    integer
    page number
    default: 1

    GET /answer_sets/:id

    Get a single answer_set

    require 'rest-client'
    
    answer_set_id = 'PUT-YOUR-ANSWER_SET-ID-HERE'
    
    RestClient::Request.execute method: :get,
      url: "https://api.diduenjoy.com/api/v1/answer_sets/#{answer_set_id}",
      user: 'PUT-YOUR-API-KEY-HERE'
    

    attributes

    attribute description
    created_at
    datetime
    answer_set creation date
    updated_at
    datetime
    answer_set last modification date
    comment
    string
    responder comment
    completed
    boolean
    equal "true" if the responder completed all your survey pages else "false"
    status
    string
    status of the answer set. Possible values: live or deleted
    would_recommend
    integer
    responder recommendation note
    segments
    hash { string: string|array[string] }
    custom data associated with the answer_set
    tags
    hash { string: string|array[string] }
    custom tags associated with the answer_set
    root_causes
    hash { string: string|array[string] }
    custom root causes associated with the answer_set
    action_taken
    hash { string: string|array[string] }
    custom action taken associated with the answer_set
    resolved
    boolean
    equal "true" if the answer_set has been set to resolved
    dispatch_sent_at
    datetime
    sending date of the answer_set
    completed_at
    datetime
    answer completion date
    last_opening_date
    datetime
    last opening date of the answer_set
    first_resolution_date
    datetime
    date of the first resolution
    last_resolution_date
    datetime
    date of the last resolution
    resolution_time
    integer
    the total combined time answer_set was in the new, open, and on-hold statuses
    full_resolution_time
    integer
    duration between answer_set creation and its most recent resolution
    resolver_account
    email
    resolver email
    answers
    array[hash]
    answers ex: [
     {
      "label": "Short Comment",
      "kind": "short_text_input",
      "translations": {"ar": "Short Comment - ar","en": "Short Comment - en"},
      "value": "short text"
     },
     {
      "label": "NPS",
      "kind": "rating",
      "translations":{"ar": "NPS - ar","en": "NPS - en"},
      "value": 8,
      "rating_scale":{"min": "1","max": "10"}
     },
     {
      "label": "Multi Select",
      "kind": "multiple_select",
      "translations":{"ar":"Multi Select - ar","en": "Multi Select - en"},
      "value": ["A","B","C"]
     }
    ]
    company_language
    string
    language of the company
    comment_translation
    string
    comment translated into company language
    profile
    string
    respondent profile ('detractor','passive','promoter','unknown')
    permalink
    string
    link to the answer_set in the dashboard messaging section.

    relationships

    relationship description
    survey answer_set survey
    client answer_set responder
    survey_language answer_set survey_language
    choices responder choices
    answers responder answers
    feedback_tags answer_set tags
    messages feedback messages (from client and company)

    GET /answer_sets

    List all your answer_sets (feedback)

    require 'rest-client'
    
    RestClient::Request.execute method: :get,
      url: 'https://api.diduenjoy.com/api/v1/answer_sets',
      user: 'PUT-YOUR-API-KEY-HERE'
    
    ---------------Filter[would_recommend]--------------------------
    require 'rest-client'
    
    RestClient::Request.execute method: :get,
      url: "https://api.diduenjoy.com/api/v1/answer_sets?filter[would_recomend][]=2,3,4",
      user: 'PUT-YOUR-API-KEY-HERE'
    

    attributes

    attribute description
    created_at
    datetime
    answer_set creation date
    updated_at
    datetime
    answer_set last modification date
    comment
    string
    responder comment
    completed
    boolean
    equal "true" if the responder completed all your survey pages else "false"
    status
    string
    status of the answer set. Possible values: live or deleted
    would_recommend
    integer
    responder recommendation note
    segments
    hash { string: string|array[string] }
    custom data associated with the answer_set
    tags
    hash { string: string|array[string] }
    custom tags associated with the answer_set
    root_causes
    hash { string: string|array[string] }
    custom root causes associated with the answer_set
    action_taken
    hash { string: string|array[string] }
    custom action taken associated with the answer_set
    resolved
    boolean
    equal "true" if the feedback has been set to resolved
    dispatch_sent_at
    datetime
    sending date of the feedback
    completed_at
    datetime
    answer completion date
    last_opening_date
    datetime
    last opening date of the answer_set
    first_resolution_date
    datetime
    date of the first resolution
    last_resolution_date
    datetime
    date of the last resolution
    resolution_duration
    integer
    the total combined time answer_set was in the new, open, and on-hold statuses
    full_resolution_duration
    integer
    duration between answer_set creation and its most recent resolution
    resolver_account
    email
    resolver email
    answers
    array[hash]
    answers ex: [
     {
      "label": "Short Comment",
      "kind": "short_text_input",
      "translations": {"ar": "Short Comment - ar","en": "Short Comment - en"},
      "value": "short text"
     },
     {
      "label": "NPS",
      "kind": "rating",
      "translations":{"ar": "NPS - ar","en": "NPS - en"},
      "value": 8,
      "rating_scale":{"min": "1","max": "10"}
     },
     {
      "label": "Multi Select",
      "kind": "multiple_select",
      "translations":{"ar":"Multi Select - ar","en": "Multi Select - en"},
      "value": ["A","B","C"]
     }
    ]
    company_language
    string
    language of the company
    comment_translation
    string
    comment translated into company language
    profile
    string
    respondent profile ('detractor','passive','promoter','unknown')
    permalink
    string
    link to the answer_set in the dashboard messaging section.

    optional parameters "filter"

    parameter description
    completed
    boolean
    filter over answer_sets of the indicated completed status
    status
    string
    filter over answer_sets status
    survey_id
    array
    filter over answer_sets of the indicated surveys
    client_id
    array
    filter over answer_sets of the indicated clients
    would_recommend
    array
    filter over answer_sets of the indicated ratings
    start_date
    date
    filter over answer_sets answered after the specified date
    end_date
    date
    filter over answer_sets answered before the specified date
    start_sending_date
    date
    filter over answer_sets sent after the specified sending date
    end_sending_date
    date
    filter over answer_sets sent before the specified sending date
    start_updated_date
    date
    filter over answer_sets updated after the specified date
    end_updated_date
    date
    filter over answer_sets updated before the specified date
    segments
    hash { string: string|array[string] }
    filter over answer_sets with specific segments values, to use if you expect the query to return a large number of results
    unique_segments
    hash { string: string|array[string] }
    filter over answer_sets with specific segments values, to use if you expect the query to return a small number of results
    comment
    string
    filter by presence or absence of a comment. Valid values: 'with', 'without'.

    relationships

    relationship description
    survey answer_set survey
    client answer_set responder
    survey_language answer_set survey_language
    choices responder choices
    answers responder answers
    feedback_tags answer_set tags
    messages feedback messages (from client and company)

    POST /answer_sets

    Create an answer_set

    POST /api/v1/answer_sets

    {
      "data": {
        "type": "answer_sets",
        "attributes": {
          "would_recommend": 4,
          "comment": "Perfect !",
          "completed": true,
          "segments": {
            "gender": "male",
            "age": "42"
          }
        },
        "relationships": {
          "client": {
            "data": { "type": "clients", "id": "CLIENT-UUID" }
          },
          "survey_language": {
            "data": {"type": "survey_languages", "id": "SURVEY-LANGUAGE-UUID"}
          }
        }
      }
    }
    

    attributes

    attribute description
    comment
    string
    responder comment
    completed
    boolean
    Set to true to mark the answer_set as completed and trigger the associated scenarii and third party integrations
    would_recommend
    integer
    responder recommendation note
    segments
    hash { string: string|array[string] }
    custom data associated with the answer set

    relationships

    relationship description
    client
    required
    answer_set responder
    survey_language
    required
    answer_set survey_language

    PUT /answer_sets/:id

    Update an answer_set

    PUT /api/v1/answer_sets/:id

    {
      "data": {
        "type": "answer_sets",
        "attributes": {
            "resolved": true
        }
      }
    }
    

    attributes

    attribute description
    resolved
    required boolean
    answer_set status

    PATCH /answer_sets/:id

    Update attributes of an answer_set

    PATCH /api/v1/answer_sets/:id

    {
      "data": {
        "type": "answer_sets",
        "attributes": {
            "resolved": true,
            "resolver": "john.doe@example.com",
            "root_causes": ["ROOT-CAUSE-1-UUID", "ROOT-CAUSE-2-UUID"],
            "action_taken": ["ACTION-TAKEN-1-UUID", "ACTION-TAKEN-2-UUID"]
        }
      }
    }
    

    attributes

    attribute description
    resolved
    boolean optional
    new answer_set status.
    resolver
    string optional
    answer_set resolver email.
    root_causes
    array[string] optional
    list of root_causes to link to the answer_set. It will overwrite the previous list.
    action_taken
    array[string] optional
    list of action_taken to link to the answer_set. It will overwrite the previous list.

    GET /choices/:id

    Get a single choice

    require 'rest-client'
    
    choice_id = 'PUT-YOUR-CHOICE-ID-HERE'
    
    RestClient::Request.execute method: :get,
      url: "https://api.diduenjoy.com/api/v1/choices/#{choice_id}",
      user: 'PUT-YOUR-API-KEY-HERE'
    

    attributes

    attribute description
    note
    integer
    choice note

    relationships

    relationship description
    answer_sets choice answer_set
    question choice question

    GET /clients/:id

    Get a single responder

    require 'rest-client'
    
    client_id = 'PUT-YOUR-CLIENT-ID-HERE'
    
    RestClient::Request.execute method: :get,
      url: "https://api.diduenjoy.com/api/v1/client/#{client_id}",
      user: 'PUT-YOUR-API-KEY-HERE'
    

    attributes

    attribute description
    email
    string
    client email

    relationships

    relationship description
    answer_sets client answer_sets

    GET /clients

    List all your clients

    require 'rest-client'
    
    RestClient::Request.execute method: :get,
      url: 'https://api.diduenjoy.com/api/v1/clients',
      user: 'PUT-YOUR-API-KEY-HERE'
    

    attributes

    attribute description
    email
    string
    client name

    optional parameters "filters"

    parameter description
    email
    array
    filter over clients of the indicated emails

    relationships

    relationship description
    answer_sets client answer_sets

    POST /clients

    Create a responder profile

    POST /api/v1/clients

    {
      "data": {
          "type": "clients",
          "attributes": {
            "email": "example@example.com"
          }
        }
    }
    

    attributes

    attribute description
    email
    string (required)
    client email

    GET /companies

    Get all your companies

    require 'rest-client'
    
    RestClient::Request.execute method: :get,
      url: 'https://api.diduenjoy.com/api/v1/companies',
      user: 'PUT-YOUR-API-KEY-HERE'
    

    attributes

    attribute description
    created_at
    datetime
    company creation date
    updated_at
    datetime
    company last modification date
    name
    string
    company name

    relationships

    relationship description
    surveys company surveys

    GET /companies/:id

    Get a single company

    require 'rest-client'
    
    company_id = 'PUT-YOUR-COMPANY-ID-HERE'
    
    RestClient::Request.execute method: :get,
      url: "https://api.diduenjoy.com/api/v1/companies/#{company_id}",
      user: 'PUT-YOUR-API-KEY-HERE'
    

    attributes

    attribute description
    created_at
    datetime
    company creation date
    updated_at
    datetime
    company last modification date
    name
    string
    company name

    relationships

    relationship description
    surveys company surveys

    GET /languages/:id

    Get a language available for survey responders

    require 'rest-client'
    
    language_id = 'PUT-YOUR-LANGUAGE-ID-HERE'
    
    RestClient::Request.execute method: :get,
      url: "https://api.diduenjoy.com/api/v1/languages/#{language_id}",
      user: 'PUT-YOUR-API-KEY-HERE'
    

    attributes

    attribute description
    name
    string
    language name
    tag
    string
    language ISO 639-1 code
    is_available_company_side
    boolean
    equal "true" if is available as Diduenjoy dashboard language else "false"

    GET /languages

    List all languages available for survey responders

    require 'rest-client'
    
    RestClient::Request.execute method: :get,
      url: 'https://api.diduenjoy.com/api/v1/languages',
      user: 'PUT-YOUR-API-KEY-HERE'
    

    attributes

    attribute description
    name
    string
    language name
    tag
    string
    language ISO 639-1 code
    is_available_company_side
    boolean
    equal "true" if is available as Diduenjoy dashboard language else "false"

    optional parameters "filters"

    parameter description
    tag
    array
    filter over languages of the indicated tags

    GET /messages/:id

    Get a single message

    require 'rest-client'
    
    message_id = 'PUT-YOUR-MESSAGE-ID-HERE'
    
    RestClient::Request.execute method: :get,
      url: "https://api.diduenjoy.com/api/v1/messages/#{message_id}",
      user: 'PUT-YOUR-API-KEY-HERE'
    

    attributes

    attribute description
    created_at
    datetime
    message creation date
    updated_at
    datetime
    message last modification date
    text
    string
    message text
    from_client
    boolean
    equal "true" if the message has been sent
    unread
    boolean
    equal "true" if the message has been read
    is_note
    boolean
    equal "true" if the message is a note
    author
    string
    author name and email address

    relationships

    relationship description
    answer_sets message answer_set

    POST /messages

    Create a message

    POST /api/v1/messages

    {
      "data": {
        "type": "messages",
        "attributes": {
          "text": "Great store!",
          "is_note": false,
          "sender_email": "email@example.com"
        },
        "relationships": {
          "answer_set": {
            "data": { "id": "ANSWER-SET-UUID", "type": "answer_sets" }
          }
        }
      }
    }
    

    attributes

    attribute description
    text
    string
    message text
    is_note
    boolean
    equal "true" if the message is a note
    sender_email
    string
    message author email

    relationships

    relationship description
    answer_sets message answer_set

    GET /questions/:id

    Get a single question

    require 'rest-client'
    
    question_id = 'PUT-YOUR-QUESTION-ID-HERE'
    
    RestClient::Request.execute method: :get,
      url: "https://api.diduenjoy.com/api/v1/questions/#{question_id}",
      user: 'PUT-YOUR-API-KEY-HERE'
    

    attributes

    attribute description
    position
    integer
    question position
    text
    string
    question text

    relationships

    relationship description
    survey_language question survey_language

    GET /answers/:id

    Get a single answer

    require 'rest-client'
    
    answer_id = 'PUT-YOUR-ANSWER-ID-HERE'
    
    RestClient::Request.execute method: :get,
      url: "https://api.diduenjoy.com/api/v1/answers/#{answer_id}",
      user: 'PUT-YOUR-API-KEY-HERE'
    

    attributes

    attribute description
    value
    string
    value of the answer
    displayed_value
    string
    value of the answer displayed in the survey
    label
    string
    label of the related question
    step_relative_position
    integer
    relative position of the step in the survey
    element_relative_position
    integer
    relative position of the step in the survey
    kind
    string
    kind of the related question
    new_question_id
    string
    id of the related question
    localised_label
    string
    label of the related question translated into company language

    relationships

    relationship description
    answer_sets answer answer_set

    GET /feedback_tags/:id

    Get a single feedback_tag

    require 'rest-client'
    
    feedback_tag_id = 'PUT-YOUR-FEEDBACK_TAG-ID-HERE'
    
    RestClient::Request.execute method: :get,
      url: "https://api.diduenjoy.com/api/v1/feedback_tags/#{feedback_tag_id}",
      user: 'PUT-YOUR-API-KEY-HERE'
    

    attributes

    attribute description
    tag_name
    string
    name of the related tag
    tag_id
    string
    id of the related tag
    tag_kind
    string
    kind of the related tag (tag, root_cause, action_taken)
    created_at
    datetime
    feedback_tag creation date
    feeling
    string
    feedback_tag feeling (positive, neutral, negative)
    auto
    boolean
    equal "true" if the feedback_tag has been automatically assigned

    relationships

    relationship description
    answer_sets feedback_tag answer_set

    GET /tags/:id

    Get a single tag

    require 'rest-client'
    
    tag_id = 'PUT-YOUR-TAG-ID-HERE'
    
    RestClient::Request.execute method: :get,
      url: "https://api.diduenjoy.com/api/v1/tags/#{tag_id}",
      user: 'PUT-YOUR-API-KEY-HERE'
    

    attributes

    attribute description
    name
    string
    name of the tag

    GET /tags

    Get all the tags of the company

    require 'rest-client'
    
    RestClient::Request.execute method: :get,
      url: 'https://api.diduenjoy.com/api/v1/tags',
      user: 'PUT-YOUR-API-KEY-HERE'
    
    ---------------Filter--------------------------
    require 'rest-client'
    
    RestClient::Request.execute method: :get,
      url: "https://api.diduenjoy.com/api/v1/tags?filter[name]=Delivery",
      user: 'PUT-YOUR-API-KEY-HERE'
    

    attributes

    attribute description
    name
    string
    name of the tag

    optional parameters "filter"

    parameter description
    name
    string
    return all tags whose name contains name.

    GET /root_causes/:id

    Get a single root cause

    require 'rest-client'
    
    root_cause_id = 'PUT-YOUR-ROOT_CAUSE-ID-HERE'
    
    RestClient::Request.execute method: :get,
      url: "https://api.diduenjoy.com/api/v1/root_causes/<ROOT-CAUSE-ID>",
      user: 'PUT-YOUR-API-KEY-HERE'
    

    attributes

    attribute description
    name
    string
    name of the root cause

    GET /root_causes

    Get all the root causes of the company

    require 'rest-client'
    
    RestClient::Request.execute method: :get,
      url: 'https://api.diduenjoy.com/api/v1/root_causes',
      user: 'PUT-YOUR-API-KEY-HERE'
    
    ---------------Filter--------------------------
    require 'rest-client'
    
    RestClient::Request.execute method: :get,
      url: "https://api.diduenjoy.com/api/v1/root_causes?filter[name]=Delivery",
      user: 'PUT-YOUR-API-KEY-HERE'
    

    attributes

    attribute description
    name
    string
    name of the root cause

    optional parameters "filter"

    parameter description
    name
    string
    return all root causes whose name contains name.

    GET /action_taken/:id

    Get a single action taken

    require 'rest-client'
    
    action_taken_id = 'PUT-YOUR-ACTION_TAKEN-ID-HERE'
    
    RestClient::Request.execute method: :get,
      url: "https://api.diduenjoy.com/api/v1/action_taken/<ACTION-TAKEN-ID>",
      user: 'PUT-YOUR-API-KEY-HERE'
    

    attributes

    attribute description
    name
    string
    name of the action taken

    GET /action_taken

    Get all the action takens of the company

    require 'rest-client'
    
    RestClient::Request.execute method: :get,
      url: 'https://api.diduenjoy.com/api/v1/action_taken',
      user: 'PUT-YOUR-API-KEY-HERE'
    
    ---------------Filter--------------------------
    require 'rest-client'
    
    RestClient::Request.execute method: :get,
      url: "https://api.diduenjoy.com/api/v1/action_taken?filter[name]=Delivery",
      user: 'PUT-YOUR-API-KEY-HERE'
    

    attributes

    attribute description
    name
    string
    name of the action taken

    optional parameters "filter"

    parameter description
    name
    string
    return all action taken whose name contains name.

    GET /survey_languages/:id

    Get a single survey_language

    require 'rest-client'
    
    survey_language_id = 'PUT-YOUR-SURVEY_LANGUAGE-ID-HERE'
    
    RestClient::Request.execute method: :get,
      url: "https://api.diduenjoy.com/api/v1/survey_languages/#{survey_language_id}",
      user: 'PUT-YOUR-API-KEY-HERE'
    

    attributes

    attribute description
    would_recommend_prefix
    string
    recommendation question prefix (ex: Would you recommend)
    would_recommend_text
    string
    recommendation question text
    open_question
    string
    text written above the comment textarea

    relationships

    relationship description
    survey survey
    language language
    questions localized questions

    GET /surveys/:id

    Get a single survey

    require 'rest-client'
    
    survey_id = 'PUT-YOUR-SURVEY-ID-HERE'
    
    RestClient::Request.execute method: :get,
      url: "https://api.diduenjoy.com/api/v1/surveys/#{survey_id}",
      user: 'PUT-YOUR-API-KEY-HERE'
    
    # => {
    #   data: {
    #     type: "surveys",
    #     id: "YOUR-SURVEY-ID",
    #     attributes: {
    #       created_at: "2016-01-12 17:14:53 UTC",
    #       updated_at: "2016-01-12 17:14:59 UTC",
    #       name: "Satisfaction Survey 1",
    #       hash: "dd2d2ddd2d"
    #     },
    #     relationships: {
    #       company: {
    #         data: {
    #         type: "companies",
    #         id: "YOUR-COMPANY-ID",
    #         links: {
    #           self: "http://localhost:3000/api/v1/companies/YOUR-COMPANY-ID"
    #         }
    #       }
    #     },
    #     survey_languages: {
    #       data: [
    #         {
    #           type: "survey_languages",
    #           id: "FIRST-SURVEY_LANGUAGE-ID",
    #           links: {
    #             self: "http://localhost:3000/api/v1/survey_languages/FIRST-SURVEY_LANGUAGE-ID"
    #           }
    #         },
    #         {
    #           type: "survey_languages",
    #           id: "SECOND-SURVEY_LANGUAGE-ID",
    #           links: {
    #             self: "http://localhost:3000/api/v1/survey_languages/SECOND-SURVEY_LANGUAGE-ID"
    #           }
    #         }
    #       ]
    #     }
    #   },
    #     links: {
    #       self: "http://localhost:3000/api/v1/surveys/YOUR-SURVEY-ID"
    #     }
    #   }
    # }
    

    attributes

    attribute description
    created_at
    datetime
    survey creation date
    updated_at
    datetime
    survey last modification date
    name
    string
    survey name
    status
    boolean
    survey status ('Live','deleted','archived')
    qr_hash
    string
    survey public hash, used with companies custom mailing systems
    available_locales
    array
    survey's available languages (ISO-Code & language name)

    relationships

    relationship description
    company company owning the survey
    survey_languages survey localized texts (at least 1)

    GET /surveys

    List all your surveys

    require 'rest-client'
    
    RestClient::Request.execute method: :get,
      url: 'https://api.diduenjoy.com/api/v1/surveys',
      user: 'PUT-YOUR-API-KEY-HERE'
    

    attributes

    attribute description
    created_at
    datetime
    survey creation date
    updated_at
    datetime
    survey last modification date
    name
    string
    survey name
    status
    boolean
    survey status ('Live','deleted','archived')
    qr_hash
    string
    survey public hash, used with companies custom mailing systems
    available_locales
    array
    survey's available languages (ISO-Code & language name)

    optional parameters "filters"

    parameter description
    name
    array
    filter over surveys of the indicated names
    status
    array
    filter over surveys of the indicated status ('live', 'deleted', 'archived')

    relationships

    relationship description
    company company owning the survey
    survey_languages survey localized texts (at least 1)

    GET /stats

    Get your statics key values

    require 'rest-client'
    
    RestClient::Request.execute method: :get,
      url: 'https://api.diduenjoy.com/api/v1/stats',
      user: 'PUT-YOUR-API-KEY-HERE'
    
    # example with filters
    
    RestClient::Request.execute method: :get,
      url: 'https://api.diduenjoy.com/api/v1/stats?filter[surveys][0]=Paris%20Boutique&filter[segments][city][0]=paris&filter[start_date]=Fri%20Oct%2011%202019%2002:00:00%20GMT+0200%20(Central%20European%20Summer%20Time)',
      user: 'PUT-YOUR-API-KEY-HERE'
    
    # => {
    #   "total": 74,
    #   "score": 6.594594594594595,
    #   "promoter_count": 31,
    #   "passiv_count": 17,
    #   "detractor_count": 26,
    #   "nps": 7,
    #   "sent": 120
    #}
    

    attributes

    attribute description
    total
    integer
    total number of found feedbacks
    score
    float
    average score
    promoter_count
    integer
    number of promoter profiles
    passiv_count
    integer
    number of passiv profiles
    detractor_count
    integer
    number of detractor profiles
    nps
    integer
    net promoter score, integer varying from -100 to +100 depending on the number of promoters and detractors
    sent
    integer
    number of sent surveys

    optional parameters "filters"

    parameter description
    surveys
    array
    filter over feedback of the indicated surveys
    segments
    array
    associative array of segments, where segments names are the keys and the values are the. To filter over feedbacks having the specified segments name with the corresponding values
    start_date
    date
    filter on feedback answered after the specified date
    end_date
    date
    filter on feedback answered before the specified date

    GET /users

    List all your users

    require 'rest-client'
    
    RestClient::Request.execute method: :get,
      url: "https://api.diduenjoy.com/api/v1/users",
      user: 'PUT-YOUR-API-KEY-HERE'
    

    attributes

    attribute description
    email
    string
    user email
    firstname
    string
    user firstname
    lastname
    string
    user lastname
    phone_number
    string
    user phone number
    user_role_type
    enum
    user role (admin, manager, custom)
    saml_enabled
    boolean
    user use a single sign
    custom_user_role_id
    string
    user custom role id (If user_role_type is custom)
    language_id
    string
    user language id (default: Dashboard company language)
    segments
    hash _{ segmentid: string|array[string] }
    user restricted segments values
    created_at
    datetime
    user creation date
    updated_at
    datetime
    user last modification date

    optional parameters "filter"

    parameter description
    segments[segment-name]
    array
    filter users over segment value(s)
    email
    string
    filter users over the indicated emails (separated by commas)

    GET /users/:id

    Get a single user

    require 'rest-client'
    
    user_id = 'PUT-USER-ID-HERE'
    
    RestClient::Request.execute method: :get,
      url: "https://api.diduenjoy.com/api/v1/users/#{user_id}",
      user: 'PUT-YOUR-API-KEY-HERE'
    

    attributes

    attribute description
    email
    string
    user email
    firstname
    string
    user firstname
    lastname
    string
    user lastname
    phone_number
    string
    user phone number
    user_role_type
    enum
    user role (admin, manager, custom)
    saml_enabled
    boolean
    user use a single sign
    custom_user_role_id
    string
    user custom role id (If user_role_type is custom)
    language_id
    string
    user language id (default: Dashboard company language)
    segments
    hash _{ segmentid: string|array[string] }
    user restricted segments values
    created_at
    datetime
    user creation date
    updated_at
    datetime
    user last modification date

    POST /users

    Create a user

    POST /api/v1/users

    {
      "data": {
        "type": "users",
        "attributes": {
          "email": "jhon.due@example.com",
          "firstname": "jhon",
          "lastname": "due",
          "saml_enabled": false,
          "user_role_type": "custom",
          "custom_user_role_id": "8836a1ef-1419-497f-960a-ef3024b0f8d4"
        }
      }
    }
    

    attributes

    attribute description
    email
    string
    user email
    firstname
    string
    user firstname
    lastname
    string
    user lastname
    phone_number
    string
    user phone number
    user_role_type
    enum
    user role (admin, manager, custom)
    saml_enabled
    boolean
    user use a single sign
    force_invitation_email
    boolean
    invitation email will be sent regardless of :saml_enabled (optional)
    custom_user_role_id
    string
    user custom role id (If user_role_type is custom)
    language_id
    string
    user language id (default: Dashboard company language)
    segments
    hash _{ segmentid: string|array[string] }
    user restricted segments values

    PATCH /users/:id

    Update a user

    PATCH /api/v1/users/{USER_ID}

    {
      "data": {
        "type": "users",
        "attributes": {
          "email": "jhon.due@example.com",
          "firstname": "jhon",
          "lastname": "due",
          "saml_enabled": false,
          "user_role_type": "custom",
          "custom_user_role_id": "8836a1ef-1419-497f-960a-ef3024b0f8d4"
        }
      }
    }
    

    attributes

    attribute description
    email
    string
    user email
    firstname
    string
    user firstname
    lastname
    string
    user lastname
    phone_number
    string
    user phone number
    user_role_type
    enum
    user role (admin, manager, custom)
    saml_enabled
    boolean
    user use a single sign
    custom_user_role_id
    string
    user custom role id (If user_role_type is custom)
    language_id
    string
    user language id (default: Dashboard company language)
    segments
    hash _{ segmentid: string|array[string] }
    user restricted segments values

    DELETE /users/:id

    Delete a users

    require 'rest-client'
    
    user_id = 'PUT-USER-ID-HERE'
    
    RestClient::Request.execute method: :delete,
      url: "https://api.diduenjoy.com/api/v1/users/#{user_id}",
      user: 'PUT-YOUR-API-KEY-HERE'
    

    GET /user_roles

    List all your user roles

    require 'rest-client'
    
    RestClient::Request.execute method: :get,
      url: "https://api.diduenjoy.com/api/v1/user_roles",
      user: 'PUT-YOUR-API-KEY-HERE'
    

    attributes

    attribute description
    name
    string
    user role name

    GET /user_roles/:id

    Get a single user role

    require 'rest-client'
    
    user_role_id = 'PUT-USER-ROLE-ID-HERE'
    
    RestClient::Request.execute method: :get,
      url: "https://api.diduenjoy.com/api/v1/user_roles/#{user_role_id}",
      user: 'PUT-YOUR-API-KEY-HERE'
    

    attributes

    attribute description
    name
    string
    user role name

    GET /data_logs/:id

    Get a single data_log

    require 'rest-client'
    
    data_log_id = 'PUT-YOUR-DATA_LOG-ID-HERE'
    
    RestClient::Request.execute method: :get,
      url: "https://api.diduenjoy.com/api/v1/data_logs/#{data_log_id}",
      user: 'PUT-YOUR-API-KEY-HERE'
    

    attributes

    attribute description
    data_id
    string
    id of the related data
    data_modified
    string
    type of the modified data
    operation_type
    string
    operation type ('delete','soft_delete','restore','update_rating','solved','add_message','change_tag','rename')
    created_at
    datetime
    data_log creation date

    GET /data_logs

    Get all the data_logs of the company

    require 'rest-client'
    
    RestClient::Request.execute method: :get,
      url: 'https://api.diduenjoy.com/api/v1/data_logs',
      user: 'PUT-YOUR-API-KEY-HERE'
    
    ---------------Filter--------------------------
    require 'rest-client'
    
    RestClient::Request.execute method: :get,
      url: "https://api.diduenjoy.com/api/v1/data_logs?[start_date]=2023-06-05&filter[end_date]=2023-07-05",
      user: 'PUT-YOUR-API-KEY-HERE'
    

    attributes

    attribute description
    data_id
    string
    id of the related data
    data_modified
    string
    type of the modified data
    operation_type
    string
    operation type ('delete','soft_delete','restore','update_rating','solved','add_message','change_tag','rename')
    created_at
    datetime
    data_log creation date

    optional parameters "filter"

    parameter description
    start_date
    date
    filter over data_logs created after the specified date
    end_date
    date
    filter over data_logs created before the specified date

    GET /data_requests/:data_subject/:feedback_id

    Returns the segments of the provided feedback, that describe the provided data subject

    Possible data_subject values

    require 'rest-client'
    
    data_subject = 'PUT-YOUR-DATA-SUBJECT'
    feedback_id = 'PUT-YOUR-FEEDBACK-ID'
    
    RestClient::Request.execute method: :get,
      url: "https://api.diduenjoy.com/api/v1/data_requests/#{data_subject}/#{feedback_id}",
      user: 'PUT-YOUR-API-KEY-HERE'
    

    attributes

    attribute description
    segments
    hash { string: string|array[string] }
    data from segments of the provided data_subject
    email
    string
    optional - present if provided data_subject corresponds to the default data_subject
    phone_number
    string
    optional - present if provided data_subject corresponds to the default data_subject

    PATCH /data_requests/:data_subject/:feedback_id

    Updates segments for the provided feedback and the provided data subject

    Possible data_subject values

    PATCH /api/v1/data_requests/:data_subject/:feedback_id

    {
      "data": {
        "type": "data_requests",
        "attributes": {
            "segments": {
                "contact_first_name": "xxx",
                "contact_last_name": "xxx"
            },
            "phone_number": "33606060606"
        }
      }
    }
    

    attributes

    attribute description
    segments
    hash { string: string|array[string] }
    new data for segments of the provided data_subject
    email
    string
    optional
    phone_number
    string
    optional

    DELETE /data_requests/:data_subject/:feedback_id

    Anonymize segments for the provided feedback and the provided data subject

    Possible data_subject values

    require 'rest-client'
    
    data_subject = 'PUT-YOUR-DATA-SUBJECT'
    feedback_id = 'PUT-YOUR-FEEDBACK-ID'
    
    RestClient::Request.execute method: :delete,
      url: "https://api.diduenjoy.com/api/v1/data_requests/#{data_subject}/#{feedback_id}",
      user: 'PUT-YOUR-API-KEY-HERE'
    

    Easy API V1 Reference

    Our easy API provide very simple methods to use Diduenjoy API

    POST /easy_dispatches

    Send a survey to a specified email address

    require 'rest-client'
    
    RestClient::Request.execute method: :post,
      url: 'https://api.diduenjoy.com/api/v1/easy_dispatches',
      user: 'PUT-YOUR-API-KEY-HERE',
      headers: {
        content_type: 'application/json'
      },
      payload: {
        email: 'client@example.com', # or phone_number: '+336xxxxxxxx'
        survey_id: 'YOUR-SURVEY-ID-HERE',
        template_id: 'YOUR-TEMPLATE-ID-HERE',
        segments: {
          language: 'EN',
          scheduled_at: '2022-04-18 15:07:00',
          gender: 'Mister',
          name: 'Rick Sanchez',
          interests: 'Science',
        },
        dispatch_probability: 0.5
      }.to_json
    
    # => {
    #     "id": "DISPATCH-ID",
    #     "email": "client@example.com", # or "phone_number": "+336xxxxxxxx"
    #     "survey_id": "YOUR-SURVEY-ID-HERE",
    #     "template_id": "YOUR-TEMPLATE-ID-HERE",
    #     "segments": {
    #       "language": "EN",
    #       "scheduled_at": "2022-04-18 15:07:00",
    #       "gender": "Mister",
    #       "name": "Rick Sanchez",
    #       "interests": "Science"
    #     },
    #      "dispatch_probability": 0.5
    #   }
    
    $api_key = 'YOUR-API-KEY-HERE';
    $survey_id = 'YOUR-SURVEY-ID-HERE';
    $template_id = 'YOUR-TEMPLATE-ID-HERE',
    $email = 'client@example.com'; // or $phone_number = '+336xxxxxxxx'
    $date = '2022-04-18 15:07:00';
    
    $payload = array(
      'email' => $email, // or 'phone_number' => $phone_number
      'survey_id' => $survey_id,
      'template_id' => $template_id,
      'segments' => array(
        'language' => 'EN',
        'scheduled_at' => $date,
        'gender' => 'Mister',
        'name' => 'Rick Sanchez',
        'interests' => 'Science'
      ),
      'dispatch_probability' => 0.5
    );
    
    $ch = curl_init('https://api.diduenjoy.com/api/v1/easy_dispatches');
    
    curl_setopt_array($ch, array(
        CURLOPT_POST => TRUE,
        CURLOPT_HTTPHEADER => array(
            'Content-Type: application/json'
        ),
        CURLOPT_USERPWD => "$api_key:",
        CURLOPT_HTTPAUTH => CURLAUTH_BASIC,
        CURLOPT_POSTFIELDS => json_encode($payload)
    ));
    
    // Send the request
    $response = curl_exec($ch);
    
    // => {
    //     "id": "DISPATCH-ID",
    //     "email": "client@example.com", // or "phone_number":"+336xxxxxxxx"
    //     "survey_id": "YOUR-SURVEY-ID-HERE",
    //     "template_id": "YOUR-TEMPLATE-ID-HERE",
    //     "segments": {
    //       "language": "EN",
    //       "scheduled_at": "2022-04-18 15:07:00",
    //       "gender": "Mister",
    //       "name": "Rick Sanchez",
    //       "interests": "Science"
    //     },
    //    "dispatch_probability": 0.5
    //   }
    

    attributes

    attribute description
    email
    string
    either email or phone number or no_dispatch required email address to which send the survey
    phone_number
    string
    either email or phone number or no_dispatch required phone number to which the survey will be send. The international format should be used (ex: +33)
    survey_id
    string
    required id of the survey
    template_id
    string
    either template_id or no_dispatch required id of the template
    segments
    hash { string: string }
    custom data associated with the survey
    dispatch_probability
    string
    probability for the survey to be sent
    no_dispatch
    boolean
    set it to disable sending of the survey and only create an new feedback that you could dispatch by your own means

    Segments

    All segments are dynamically created, you can name them as you want.

    There is 2 exceptions:

    Remarks

    POST /easy_dispatches_without_validations

    Send a survey to a specified email address. In case provided parameters are not correct, no error is returned.

    require 'rest-client'
    
    RestClient::Request.execute method: :post,
      url: 'https://api.diduenjoy.com/api/v1/easy_dispatches_without_validations',
      user: 'PUT-YOUR-API-KEY-HERE',
      headers: {
        content_type: 'application/json'
      },
      payload: {
        email: 'client@example.com', # or phone_number: '+336xxxxxxxx'
        survey_id: 'YOUR-SURVEY-ID-HERE',
        template_id: 'YOUR-TEMPLATE-ID-HERE',
        segments: {
          language: 'EN',
          scheduled_at: '2022-04-18 15:07:00',
          gender: 'Mister',
          name: 'Rick Sanchez',
          interests: 'Science',
        },
        dispatch_probability: 0.5
      }.to_json
    
    # => {
    #     "id": "DISPATCH-ID",
    #     "email": "client@example.com", # or "phone_number": "+336xxxxxxxx"
    #     "survey_id": "YOUR-SURVEY-ID-HERE",
    #     "template_id": "YOUR-TEMPLATE-ID-HERE",
    #     "segments": {
    #       "language": "EN",
    #       "scheduled_at": "2022-04-18 15:07:00",
    #       "gender": "Mister",
    #       "name": "Rick Sanchez",
    #       "interests": "Science"
    #     },
    #      "dispatch_probability": 0.5
    #   }
    
    $api_key = 'YOUR-API-KEY-HERE';
    $survey_id = 'YOUR-SURVEY-ID-HERE';
    $template_id = 'YOUR-TEMPLATE-ID-HERE',
    $email = 'client@example.com'; // or $phone_number = '+336xxxxxxxx'
    $date = '2022-04-18 15:07:00';
    
    $payload = array(
      'email' => $email, // or 'phone_number' => $phone_number
      'survey_id' => $survey_id,
      'template_id' => $template_id,
      'segments' => array(
        'language' => 'EN',
        'scheduled_at' => $date,
        'gender' => 'Mister',
        'name' => 'Rick Sanchez',
        'interests' => 'Science'
      ),
      'dispatch_probability' => 0.5
    );
    
    $ch = curl_init('https://api.diduenjoy.com/api/v1/easy_dispatches_without_validations');
    
    curl_setopt_array($ch, array(
        CURLOPT_POST => TRUE,
        CURLOPT_HTTPHEADER => array(
            'Content-Type: application/json'
        ),
        CURLOPT_USERPWD => "$api_key:",
        CURLOPT_HTTPAUTH => CURLAUTH_BASIC,
        CURLOPT_POSTFIELDS => json_encode($payload)
    ));
    
    // Send the request
    $response = curl_exec($ch);
    
    // => {
    //     "id": "DISPATCH-ID",
    //     "email": "client@example.com", // or "phone_number":"+336xxxxxxxx"
    //     "survey_id": "YOUR-SURVEY-ID-HERE",
    //     "template_id": "YOUR-TEMPLATE-ID-HERE",
    //     "segments": {
    //       "language": "EN",
    //       "scheduled_at": "2022-04-18 15:07:00",
    //       "gender": "Mister",
    //       "name": "Rick Sanchez",
    //       "interests": "Science"
    //     },
    //    "dispatch_probability": 0.5
    //   }
    

    attributes

    attribute description
    email
    string
    either email or phone number or no_dispatch required email address to which send the survey
    phone_number
    string
    either email or phone number or no_dispatch required phone number to which the survey will be send. The international format should be used (ex: +33)
    survey_id
    string
    required id of the survey
    template_id
    string
    either template_id or no_dispatch required id of the template
    segments
    hash { string: string }
    custom data associated with the survey
    dispatch_probability
    string
    probability for the survey to be sent
    no_dispatch
    boolean
    set it to disable sending of the survey and only create an new feedback that you could dispatch by your own means

    Segments

    All segments are dynamically created, you can name them as you want.

    There is 2 exceptions:

    Remarks