nifi-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chakrader Dewaragatla <Chakrader.Dewaraga...@lifelock.com>
Subject Re: Rest API for templates.
Date Tue, 01 Dec 2015 23:38:01 GMT
Matt – Thanks for reply and sorry for delay in trying out.
I have problem importing and errors as “template is not in a valid format”

Here is the curl command and output of the import template command.


% curl -X POST -H"ContentType:text/xml" -H"Accept:application/xml" http://localhost:9080/nifi-api/controller/templates
-F"name=template" -F”filename=template_request.xml"  -F"upload=@./template_request.xml"
-v

*   Trying ::1...

* connect to ::1 port 9080 failed: Connection refused

*   Trying 127.0.0.1...

* Connected to localhost (127.0.0.1) port 9080 (#0)

> POST /nifi-api/controller/templates HTTP/1.1

> Host: localhost:9080

> User-Agent: curl/7.43.0

> ContentType:text/xml; Content-Disposition: form-data;

> Accept:application/xml

> Content-Length: 11377

> Expect: 100-continue

> Content-Type: multipart/form-data; boundary=------------------------51d5291195f283d6

>

< HTTP/1.1 100 Continue

< HTTP/1.1 200 OK

< Date: Tue, 01 Dec 2015 22:34:41 GMT

< Content-Type: application/xml

< Vary: Accept-Encoding, User-Agent

< Transfer-Encoding: chunked

< Server: Jetty(9.2.11.v20150529)

<

* Connection #0 to host localhost left intact

<errorResponse status="400" statusText="The specified template is not in a valid format.”/>



From: Matt Gilman <matt.c.gilman@gmail.com<mailto:matt.c.gilman@gmail.com>>
Reply-To: "users@nifi.apache.org<mailto:users@nifi.apache.org>" <users@nifi.apache.org<mailto:users@nifi.apache.org>>
Date: Wednesday, November 4, 2015 at 5:12 PM
To: "users@nifi.apache.org<mailto:users@nifi.apache.org>" <users@nifi.apache.org<mailto:users@nifi.apache.org>>
Subject: Re: Rest API for templates.

Chakri,

The endpoint exists but due to a shortcoming in the documentation tool it does not get included.
There are two different options for importing a template. Both are located at

POST https://{host}:{port}/nifi-api/controller/templates

You can invoke this endpoint three different ways. The way that gets included in the documentation
creates a new template based off a snippet identifier. This allows you to create a template
based off a snippet of your local flow.

The other two ways allow you to create a template based off of an existing one:
- One option is to send a request with multi-part form data (file upload - this is what the
UI does). The form parameter of the template is named "template".
- The next option would be to include the serialized template in the body of the request.
Specifically, this is serialized as a TemplateEntity which is the same as the response of
the first request I mentioned above (an example of this is in the documentation). This version
of the endpoint accepts application/xml or application/json.

I've received this question a couple times so I've created a JIRA for addressing it. [1]

Matt

[1] https://issues.apache.org/jira/browse/NIFI-1113

On Wed, Nov 4, 2015 at 7:14 PM, Chakrader Dewaragatla <Chakrader.Dewaragatla@lifelock.com<mailto:Chakrader.Dewaragatla@lifelock.com>>
wrote:
Hi -  I was looking at the REST apis to create, manage templates. Looks like import template
is not implemented, correct me if I am wrong ? It is not documented in API guide.

Thanks,
-Chakri

________________________________
The information contained in this transmission may contain privileged and confidential information.
It is intended only for the use of the person(s) named above. If you are not the intended
recipient, you are hereby notified that any review, dissemination, distribution or duplication
of this communication is strictly prohibited. If you are not the intended recipient, please
contact the sender by reply email and destroy all copies of the original message.
________________________________

________________________________
The information contained in this transmission may contain privileged and confidential information.
It is intended only for the use of the person(s) named above. If you are not the intended
recipient, you are hereby notified that any review, dissemination, distribution or duplication
of this communication is strictly prohibited. If you are not the intended recipient, please
contact the sender by reply email and destroy all copies of the original message.
________________________________

Mime
View raw message