using System.Net;
public static HttpResponseMessage Run(HttpRequestMessage req, out object taskDocument, TraceWriter log)
{
string name = req.GetQueryNameValuePairs()
.FirstOrDefault(q => string.Compare(q.Key, "name", true) == 0)
.Value;
string task = req.GetQueryNameValuePairs()
.FirstOrDefault(q => string.Compare(q.Key, "task", true) == 0)
.Value;
string duedate = req.GetQueryNameValuePairs()
.FirstOrDefault(q => string.Compare(q.Key, "duedate", true) == 0)
.Value;
taskDocument = new {
name = name,
duedate = duedate.ToString(),
task = task
};
if (name != "" && task != "") {
return req.CreateResponse(HttpStatusCode.OK);
}
else {
return req.CreateResponse(HttpStatusCode.BadRequest);
}
}
とfunction.jsonタスクのための代わりに名前をcoresponding
{
"bindings": [
{
"authLevel": "function",
"name": "req",
"type": "httpTrigger",
"direction": "in"
},
{
"name": "$return",
"type": "http",
"direction": "out"
},
{
"type": "documentDB",
"name": "taskDocument",
"databaseName": "taskDatabase",
"collectionName": "TaskCollection",
"createIfNotExists": true,
"connection": "DOCUMENTDB",
"direction": "out"
}
],
"disabled": false
}
使用。
ありがとうございました! @Mikkail – JViM