Azure 数据工厂中 Azure 函数的 GET 方法失败



我正在尝试调用使用GET请求触发Azure function构建的HTTP。我按照建议的步骤设置了链接服务,函数本身通过 POSTMAN 或 Internet 浏览器处理查询字符串,但在尝试通过数据工厂调用时失败。

{
"errorCode": "3608",
"message": "Call to provided Azure function '' failed with status-'NotFound' and message - 'Invoking Azure function failed with HttpStatusCode - NotFound.'.",
"failureType": "UserError",
"target": "Azure Function1",
"details": []
}

我遇到了另一个堆栈溢出帖子 https://stackoverflow.com/a/54497119/4212430 其中提到了 ADF 的JSON响应。

此后,我更改了我的python代码,以提供HTTP响应作为JSON对象,如下所示

def main(req: func.HttpRequest) -> func.HttpResponse:
logging.info('Python HTTP trigger function processed a request.')
statename = req.params.get('statename')
if not statename:
try:
req_body = req.get_json()
except ValueError:
pass
else:
statename = req_body.get('statename')
if statename:
initiate_main(statename)
host.close()
function_message = {"Response":"Successfully trasnferred BOM files"}
return func.HttpResponse(
json.dumps(function_message),
mimetype="application/json", 
status_code=200)
else:
function_message = {"Response":"Error in transferring files"}
return func.HttpResponse(
json.dumps(function_message), 
mimetype="application/json", 
status_code=400)

但这也无济于事。

事实证明,我使用了错误的URI,并在最后添加了api,而我应该只是给出普通函数名称

最新更新