douqiao3930 2014-09-25 12:35
浏览 44

如何使用POST-SELECT通过API调用FLOWGEAR工作流程

I have a workflow that selects a list of books based on projected sales value of R 5000.00 where author is "Siko Luyanda". When testing the query I created it returns me 2 records. My workflow returns the same recordsas well, happy.

I have used the Formatter node to create the sql query that is passed to my ODBC node since am querying MySQl Server. In the workflow content pane the HTTP method of the endppoint is set to GET. Invoking my workflow with php via an API call works fine:

 $results = invokeFlowgear("https://domain.flowgear.io/authorbooksaleslist", , "login", "pwd", 30,array());

The resulting output is what I get from the workflow console and the database itself I am happy.

However, the minute I change my endpoint to use POST my query fails. Take for example a HTML form that uses a POST method to hide the fields being posted.

At this point I get an exception which says, "The service is not available", if I set my endpoint to post as a method meaning I cannot do a "POST-SELECT" query via the workflow and API call. Below is how I invoke the workflow with variable bar variables as post fields.

$results = invokeFlowgear("https://domain.flowgear.io/authorbooksaleslist", "login", "pwd", 30,
       array(
        'salesValue' => 5000.00,
        'authorId' => 3
     ));

The values in the array are what I want to pass inside the Formatter node before the results are sent to the ODBC node. Eventually I should get my results listed back.

Is it ever possible to have an HTTP POSt endpoint, pass values via an API for an sql query to be run on the database and serve the results whichever way I choose?

The idea is that at some stage we would want to sensitive information even when we just want to select info from th edatabase.

  • 写回答

1条回答 默认 最新

  • dongqian3750 2014-10-01 10:29
    关注

    Your HTTP Method in the workflow must be set to POST if you are invoking the endpoint with a POST method.

    Flowgear will only populate the variables in the Variable Bar if the request body is a one tier JSON payload which is a simple key-value pair.

    If you are using another form of post, you can access the post body through the special Variable Bar property FgRequestBody.

    Hope this helps.

    评论

报告相同问题?

悬赏问题

  • ¥15 Oracle中如何从clob类型截取特定字符串后面的字符
  • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
  • ¥15 MATLAB中streamslice问题
  • ¥15 如何在炒股软件中,爬到我想看的日k线
  • ¥15 51单片机中C语言怎么做到下面类似的功能的函数(相关搜索:c语言)
  • ¥15 seatunnel 怎么配置Elasticsearch
  • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
  • ¥15 (标签-MATLAB|关键词-多址)
  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端