我在网上搜索了很多,但是我的问题找不到合适的答案。
我有一个卷曲命令,看起来是这样的:
curl -X POST --data-binary 'query=select ?s ?p ?o where {?s ?p ?o} limit 10' https://your-neptune-endpoint:port/sparql
我想知道我可以在哪个字段中添加查询参数及其在invokeHTTP处理器中的值,因为我尝试了很多方法,但都没有成功。
我的方法之一是创建一个包含以下内容的generateFlowFile:
query=select ?s ?p ?o where {?s ?p ?o} limit 10'
输出被重定向到invokehttp处理器,但是我得到了这个错误。
invokehttp.response.body
{"detailedMessage":"Missing 'query' or 'update' parameter for POST request","code":"MissingParameterException","requestId":"64bf26c2-31ab-1ee2-df39-793e0abb0d0e"}
有什么想法吗?
发布于 2022-01-12 14:06:33
所以您有一个http请求:
> POST /sparql HTTP/1.1
> User-Agent: curl/7.38.0
> Host: your-neptune-endpoint:8182
> Accept: */*
> Content-Length: 47
> Content-Type: application/x-www-form-urlencoded
您必须至少为InvokeHttp nifi设置以下参数:
HTTP Method: POST
Remote URL: https://your-neptune-endpoint:8182/sparql
SSL Context Service: <...>
Content-Type: application/x-www-form-urlencoded
Content-Type=application/x-www-form-urlencoded
声明参数将以a=v1 & b=v2 &...
格式传递。
可以使用GenerateFlowFile在InvokeHttp之前设置流文件体
query=select ?s ?p ?o where {?s ?p ?o} limit 10
注意到你问题中不必要的正文引语
如果您的参数值包含一些特殊的字符,如=
或&
,最好用GenerateFlowFile对其进行编码:
query=${'select ?s ?p ?o where {?s ?p ?o} limit 10':urlEncode()}
https://stackoverflow.com/questions/70678927
复制相似问题