1

I'm trying to connect to the Survey Monkey API via a hard coded connection set in a variable but the connection is giving me such error:

QVX_UNEXPECTED_END_OF_DATA: HTTP protocol error 400 (Bad Request):

{
 "error": 
     {
      "docs": "https://developer.surveymonkey.com/api/v3/#error-codes", 
      "message": "Invalid URL parameters.", "id": "1003", "name": "Bad Request", 
      "http_status_code": 400
     }
}

Although, if i try the same but while getting surveys bulk, it works

vID is equal to a survey id

let vURL2 = 'https://api.surveymonkey.com/v3/surveys/$(vID)/details';

RestConnectorMasterTable_SurveryFullDetails:
SQL SELECT 
    "response_count",
    "page_count",
    "date_created",
    "folder_id",
    "nickname",
    "id" AS "id_u3",
    "question_count" AS "question_count_u0",
    "category",
    "preview",
    "is_owner",
    "language",
    "footer",
    "date_modified",
    "analyze_url",
    "summary_url",
    "href" AS "href_u1",
    "title" AS "title_u0",
    "collect_url",
    "edit_url",
    "__KEY_root",
    (SELECT 
        "done_button",
        "prev_button",
        "exit_button",
        "next_button",
        "__FK_buttons_text"
    FROM "buttons_text" FK "__FK_buttons_text"),
    (SELECT 
        "__FK_custom_variables"
    FROM "custom_variables" FK "__FK_custom_variables"),
    (SELECT 
        "href" AS "href_u0",
        "description" AS "description_u0",
        "title",
        "position" AS "position_u2",
        "id" AS "id_u2",
        "question_count",
        "__KEY_pages",
        "__FK_pages",
        (SELECT 
            "sorting",
            "family",
            "subtype",
            "visible" AS "visible_u1",
            "href",
            "position" AS "position_u1",
            "validation",
            "id" AS "id_u1",
            "forced_ranking",
            "required",
            "__KEY_questions",
            "__FK_questions",
            (SELECT 
                "text",
                "amount",
                "type",
                "__FK_required"
            FROM "required" FK "__FK_required"),
            (SELECT 
                "__KEY_answers",
                "__FK_answers",
                (SELECT 
                    "visible",
                    "text" AS "text_u0",
                    "position",
                    "id",
                    "__FK_rows"
                FROM "rows" FK "__FK_rows"),
                (SELECT 
                    "description",
                    "weight",
                    "visible" AS "visible_u0",
                    "id" AS "id_u0",
                    "is_na",
                    "text" AS "text_u1",
                    "position" AS "position_u0",
                    "__FK_choices"
                FROM "choices" FK "__FK_choices")
            FROM "answers" PK "__KEY_answers" FK "__FK_answers"),
            (SELECT 
                "heading",
                "__FK_headings"
            FROM "headings" FK "__FK_headings")
        FROM "questions" PK "__KEY_questions" FK "__FK_questions")
    FROM "pages" PK "__KEY_pages" FK "__FK_pages")
FROM JSON (wrap on) "root" PK "__KEY_root"
WITH CONNECTION(Url "$(vURL2)");
Hasta Tamang
  • 2,205
  • 1
  • 18
  • 17
Giõ Hb
  • 11
  • 1

2 Answers2

0

Have you checked out this fairly exhaustive SurveyMonkey how to guide on the Qlik Community? Might we worth checking you've followed all those steps, including giving the user permission to access the API.

x3ja
  • 928
  • 5
  • 19
  • Yes i used this guide to make my connections. But when i reached the loop part, while looping into the Survey details. It throws me this error. Do you have any idea about pagination and the use of next url in the "WITH CONNECTION" – Giõ Hb Apr 05 '19 at 13:48
0

It is not enough to hardcode URL, you also need to specify authorization header

WITH CONNECTION (
Url "$(vURL2)",
HTTPHEADER "Authorization" "bearer YOUR_TOKEN"
);
Hubert Dudek
  • 1,666
  • 1
  • 13
  • 21