Hi,
I have created a custom wizard using ASP.Net/C# that uses only the 1.0 API to
create data flows in NiFI.
The code may not be 100% translatable, but here is how I do it in C#:
public ProcessorGroup ChangeProcessGroupRunningState(string groupId, bool
running)
{
using (var client = GetNifiClient())
{
StringContent jsonMessage = new StringContent(
JsonConvert.SerializeObject(new { id = groupId, state =
(running ? "RUNNING" : "STOPPED") }),
Encoding.UTF8,
"application/json");
var result = client.PutAsync(_baseURL +
string.Format("/flow/process-groups/{0}", groupId), jsonMessage).Result;
var jsonString = result.Content.ReadAsStringAsync().Result;
return JSONToObject<ProcessorGroup>(jsonString);
}
}
In the above code I build a JSON message with the Process Group ID and a state
name, either RUNNING or STOPPED, and pass it to the URL. My URL format appears
to match yours.
`GetNiFiCilent` just builds a basic HTTP Rest client and injects my
Authorization token.
The key for what is missing from your example is you have no JSON message of
what you want to change.
Regards,
Peter
-----Original Message-----
From: jgianfreda [mailto:[email protected]]
Sent: Tuesday, August 23, 2016 1:48 AM
To: [email protected]
Subject: NiFi 1.0.0-RC3 REST API to start a processgroup
Hi,
I'm trying to work with the REST API to create a workflow from scratch.
I have some troubles with how to start a process-group. I've found this route
in the API, and it is also the route used by the GUI to start or stop a process
Schedule or unschedule comopnents in the specified Process Group PUT
/flow/process-groups/{id}
But the documentation does not give any information about the query body and
nifi is excpecting one.
And if I give an empty body it says "Unsupportded media type"
Here's a full curl query example I tried
curl -H "Content-type = application/json" -v -XPUT
http://localhost:8080/nifi-api/flow/process-groups/988462af-0156-1000-3649-4ee9c8253192
Any idea?
--
View this message in context:
http://apache-nifi-developer-list.39713.n7.nabble.com/NiFi-1-0-0-RC3-REST-API-to-start-a-processgroup-tp13104.html
Sent from the Apache NiFi Developer List mailing list archive at Nabble.com.