0 Replies Latest reply: Nov 30, 2017 12:15 PM by Rodrigo Sanchez RSS

    Consume Rest Service POST with interval

    Rodrigo Sanchez

      I consume the rest Service with connector of rest service, this rest service is post and need a token but the moment when execute code, send error

       

      Error.JPG

      My body in connector is this

      {

        "interval": "2017-04-07T04:00:00.000Z/2017-04-08T04:00:00.000Z",

              "groupBy": [ "queueId" ],

        "timeZone": "America/Santiago"

      }

       

      and my code is

       

      LIB CONNECT TO 'Indicadores';

       

       

      LET vRequestBody =''; 

      LET vRequestBody = vRequestBody & '{"interval": "$(vFechaInicio)&'/'&$(vFechaFin)"&,"groupBy": [ "queueId" ],

        "timeZone": "America/Santiago"}';

      LET vRequestBody = replace(vRequestBody,'"', chr(34)&chr(34));  

         

        

       

       

      RestConnectorMasterTable:

      SQL SELECT

        "__KEY_results",

        (SELECT

        "mediaType",

        "queueId",

        "__FK_group"

        FROM "group" FK "__FK_group"),

        (SELECT

        "interval",

        "__KEY_data",

        "__FK_data",

        (SELECT

        "metric",

        "__KEY_metrics",

        "__FK_metrics",

        (SELECT

        "max",

        "min",

        "count",

        "sum",

        "ratio",

        "numerator",

        "denominator",

        "__FK_stats"

        FROM "stats" FK "__FK_stats")

        FROM "metrics" PK "__KEY_metrics" FK "__FK_metrics")

        FROM "data" PK "__KEY_data" FK "__FK_data")

      FROM JSON (wrap off) "results" PK "__KEY_results"

      WITH CONNECTION (

      HTTPHEADER "Authorization" "bearer $(vAccessToken2)",

      BODY "$(vRequestBody)"

      );