<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Create Document Action to Download JSON File of Document in Nuxeo Forum</title>
    <link>https://connect.hyland.com/t5/nuxeo-forum/create-document-action-to-download-json-file-of-document/m-p/318862#M5863</link>
    <description>&lt;P&gt;Has anyone created a document action in WebUI to download the JSON file of the document being viewed (or selected)? The Nuxeo Plugin for Chrome has a feature similar to this (it isn't downloaded, just thrown in a tab), but it would be very useful to have an action to download the JSON, or even have it be one of the options for the export action. I'm not really sure how to go about this yet, so if someone has already done it I would love to get some guidance.&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;</description>
    <pubDate>Mon, 08 Jun 2020 19:07:44 GMT</pubDate>
    <dc:creator>Phil_Ludlow</dc:creator>
    <dc:date>2020-06-08T19:07:44Z</dc:date>
    <item>
      <title>Create Document Action to Download JSON File of Document</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/create-document-action-to-download-json-file-of-document/m-p/318862#M5863</link>
      <description>&lt;P&gt;Has anyone created a document action in WebUI to download the JSON file of the document being viewed (or selected)? The Nuxeo Plugin for Chrome has a feature similar to this (it isn't downloaded, just thrown in a tab), but it would be very useful to have an action to download the JSON, or even have it be one of the options for the export action. I'm not really sure how to go about this yet, so if someone has already done it I would love to get some guidance.&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jun 2020 19:07:44 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/create-document-action-to-download-json-file-of-document/m-p/318862#M5863</guid>
      <dc:creator>Phil_Ludlow</dc:creator>
      <dc:date>2020-06-08T19:07:44Z</dc:date>
    </item>
    <item>
      <title>Re: Create Document Action to Download JSON File of Document</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/create-document-action-to-download-json-file-of-document/m-p/318863#M5864</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;There is no default automation operation for that but I guess the Browser Extension is simply using the document id endpoint: &lt;A href="https://doc.nuxeo.com/rest-api/1/document-id-endpoint/"&gt;https://doc.nuxeo.com/rest-api/1/document-id-endpoint/&lt;/A&gt;. So idea would be to wrap the REST API call within an operation, and expose it in studio to reuse it from a button.&lt;/P&gt;
&lt;P&gt;Have a great day&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jun 2020 13:08:03 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/create-document-action-to-download-json-file-of-document/m-p/318863#M5864</guid>
      <dc:creator>Gregory_Carlin</dc:creator>
      <dc:date>2020-06-09T13:08:03Z</dc:date>
    </item>
    <item>
      <title>Re: Create Document Action to Download JSON File of Document</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/create-document-action-to-download-json-file-of-document/m-p/318864#M5865</link>
      <description>&lt;P&gt;Thanks for the response. I'll see what I can do. It does seem odd that there is an export option for XML, but not for JSON. The XML is somewhat close to what I would like, but it wraps many values in CDATA tags which is a bit cumbersome.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jun 2020 19:57:08 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/create-document-action-to-download-json-file-of-document/m-p/318864#M5865</guid>
      <dc:creator>Phil_Ludlow</dc:creator>
      <dc:date>2020-06-09T19:57:08Z</dc:date>
    </item>
    <item>
      <title>Re: Create Document Action to Download JSON File of Document</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/create-document-action-to-download-json-file-of-document/m-p/318865#M5866</link>
      <description>&lt;P&gt;Yes you can create an action to download anything you want really. You can see an example in &lt;CODE&gt;nuxeo-operation-button&lt;/CODE&gt;:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://github.com/nuxeo/nuxeo-ui-elements/blob/f03857c5cbe5d49bfca1c06b6a3bf118f1471679/widgets/nuxeo-operation-button.js#L210" target="test_blank"&gt;https://github.com/nuxeo/nuxeo-ui-elements/blob/f03857c5cbe5d49bfca1c06b6a3bf118f1471679/widgets/nuxeo-operation-button.js#L210&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;When viewing a document in WebUI, you already have the document-as-JSON bound to the &lt;CODE&gt;document&lt;/CODE&gt; property. I.e. when you define your action just make sure to bind &lt;CODE&gt;document&lt;/CODE&gt;. So the trick is to convert that to a blob and download it. This is just a JavaScript exercise, nothing to do with Nuxeo in particular. Edit to add: if you're not happy with the contents of &lt;CODE&gt;document&lt;/CODE&gt; (maybe it's missing a schema or some such) you can instead use the &lt;CODE&gt;nuxeo-document&lt;/CODE&gt; element to fetch anything else you'd need:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.webcomponents.org/element/nuxeo/nuxeo-elements/elements/nuxeo-document"&gt;https://www.webcomponents.org/element/nuxeo/nuxeo-elements/elements/nuxeo-document&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;You could &lt;EM&gt;also&lt;/EM&gt; extend the export service to do a JSON export but this would require customization.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jun 2020 22:22:10 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/create-document-action-to-download-json-file-of-document/m-p/318865#M5866</guid>
      <dc:creator>Josh_Fletcher</dc:creator>
      <dc:date>2020-06-09T22:22:10Z</dc:date>
    </item>
    <item>
      <title>Re: Create Document Action to Download JSON File of Document</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/create-document-action-to-download-json-file-of-document/m-p/318866#M5867</link>
      <description>&lt;P&gt;I would say there's no explicit "export" to JSON because this is already the native format of the REST API. You just call the REST API to get your JSON (with the bonus that you have a lot of control over the response, which schemas to fetch, which enrichers to use, etc.).&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jun 2020 22:23:14 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/create-document-action-to-download-json-file-of-document/m-p/318866#M5867</guid>
      <dc:creator>Josh_Fletcher</dc:creator>
      <dc:date>2020-06-09T22:23:14Z</dc:date>
    </item>
    <item>
      <title>Re: Create Document Action to Download JSON File of Document</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/create-document-action-to-download-json-file-of-document/m-p/318867#M5868</link>
      <description>&lt;P&gt;Thanks for your comment, I must have missed it (years ago). We actually implemented a new document tab that will show the object with &lt;CODE&gt;JSON.stringify(document, null, 4)&lt;/CODE&gt; and it works well for our purposes. I will likely add an option to download the JSON as a file, but we haven't had a need for that yet.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Aug 2022 19:47:31 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/create-document-action-to-download-json-file-of-document/m-p/318867#M5868</guid>
      <dc:creator>Phil_Ludlow</dc:creator>
      <dc:date>2022-08-12T19:47:31Z</dc:date>
    </item>
  </channel>
</rss>

