Jaspersoft REST API folder traversing, XML PDF extraction - rest

Currently trying to extract an XML document that returns all the files in a particular folder, after which I can return the XML document containing files in a given folder. In the below JPG, I want to extract files from folder '02_17_2018', which is a sub-folder under '/LatestJLIPDFs' using the Jaspersoft REST API (see image below).
Basically, I'm trying to match the query http://(host):(port)/jasperserver[-pro]/rest_v2/resources?(parameters) with the Jaspersoft REST API to get to the '02_17_2018'. I've tried several different parameters, none of which seem to work. Here is a list of attempted parameters,
folderURI=/LatestJLIPDFs/02_17_2018&type=file
folderURI=/02_17_2018&type=file
folderURI=/LatestJLIPDFs&type=file&q=02_17_2018
folderURI=LatestJLIPDFs/02_17_2018&type=folder&q=02_17_2018
among many more attempts. Any hints to how the files in '02_17_2018' can be extracted?

I think your problem is related to parameter name folderURI. In the documentation, it looks like folderUri.
Let's try to write it in camel case as in my example:
http://localhost:8080/jasperserver-pro/rest_v2/resources?folderUri=/public&type=file&recursive=false

Related

Azure Factory v2 Wildcard

I am trying to create a new dataset in ADF that looks for csv files that meet a certain naming convention. These files are located within a series of different folders in my Azure Blob Storage.
For instance, in the sample directory below, I am trying to pull out csv files that contain the word "cars".
Folder A
fastcars.csv
fasttrucks.csv
Folder B
slowcars.csv
slowtrucks.csv
Ideally , I would end up with the files "slowcars.csv" and "fastcars.csv". I've seen examples out there were people were able to wildcard the file name. I have been playing around with that, but have had no luck. (See image below for one example of what I have been doing).
Is what I am trying to do even possible? Would appreciate any advice you guys may have. Please let me know if I can provide further clarification.
According to the description of filename in this documentation,
The file name under the given fileSystem + folderPath. If you want to
use a wildcard to filter files, skip this setting and specify it in
activity source settings.
so you need to specify it in activity not in file path.
A easy sample in copy activity:
Hope this can help you.

How to make a section optional when mapped to optional data in a Word OpenXml Part?

I'm using OpenXml SDK to generate word 2013 files. I'm running on a server (part of a server solution), so automation is not an option.
Basically I have an xml file that is output from a backend system. Here's a very simplified example:
<my:Data
xmlns:my="https://schemas.mycorp.com">
<my:Customer>
<my:Details>
<my:Name>Customer Template</my:Name>
</my:Details>
<my:Orders>
<my:Count>2</my:Count>
<my:OrderList>
<my:Order>
<my:Id>1</my:Id>
<my:Date>19/04/2017 10:16:04</my:Date>
</my:Order>
<my:Order>
<my:Id>2</my:Id>
<my:Date>20/04/2017 10:16:04</my:Date>
</my:Order>
</my:OrderList>
</my:Orders>
</my:Customer>
</my:Data>
Then I use Word's Xml Mapping pane to map this data to content control:
I simply duplicate the word file, and write new Xml data when generating new files.
This is working as expected. When I update the xml part, it reflects the data from my backend.
Thought, there's a case that does not works. If a customer has no order, the template content is kept in the document. The xml data is :
<my:Data
xmlns:my="https://schemas.mycorp.com">
<my:Customer>
<my:Details>
<my:Name>Some customer</my:Name>
</my:Details>
<my:Orders>
<my:Count>0</my:Count>
<my:OrderList>
</my:OrderList>
</my:Orders>
</my:Customer>
</my:Data>
(see the empty order list).
In Word, the xml pane reflects the correct data (meaning no Order node):
But as you can see, the template content is still here.
Basically, I'd like to hide the order list when there's no order (or at least an empty table).
How can I do that?
PS: If it can help, I uploaded the word and xml files, and a small PowerShell script that injects the data : repro.zip
Thanks for sharing your files so we can better help you.
I had a difficult time trying to solve your problem with your existing Word Content Controls, XML files and the PowerShell script that added the XML to the Word document. I found what seemed to be Microsoft's VSTO example solution to your problem, but I couldn't get this to work cleanly.
I was however able to write a simple C# console application that generates a Word file based on your XML data. The OpenXML code to generate the Word file was generated code from the Open XML Productivity Tool. I then added some logic to read your XML file and generate the second table rows dynamically depending on how many orders there are in the data. I have uploaded the code for you to use if you are interested in this solution. Note: The xml data file should be in c:\temp and the generated word files will be in c:\temp also.
Another added bonus to this solution is if you were to add all of the customer data into one XML file, the application will create separate word files in your temp directory like so:
customer_<name1>.docx
customer_<name2>.docx
customer_<name3>.docx
etc.
Here is the document generated from the first xml file
Here is the document generated from the second xml file with the empty row
Hope this helps.

Search string formatting in Elouqa API

I'm using the Elouqa Rest API in an integration with another product and I want to implement a file browser. As part of this I want to get a list of the folders inside another folder. Theapi documents here say that a search string can be appended but don't give any clues as to the format of the search string. I've tried various things but so far I'm just getting empty results. An example is here:
/API/rest/1.0/assets/email/folders?search=folderId+%3D+250
I've tried with and without +'s and with and without url encoding the = sign, also various combinations of quote marks but so far nothing.
I believe what you want is a slightly different endpoint e.g.:
/API/rest/1.0/assets/email/folder/250/contents
Which would provide a list of folders contained with folder 250
If you wanted to search for a given folder name then you would use
/API/rest/1.0/assets/email/folders?search=foldername
Hope that helps!

Combine two TCPDF documents

I'm using TCPDF to create two separate reports in different parts of my website. I would like that, in the end of the first report, the second report should be loaded.
It's different than import a PDF file, because the second report is also generated by TCPDF. Is there a way to do this?
I assume from your question that what you ultimately want to provide is one PDF file that consists of the first PDF concatenated with the second PDF.
One quick and dirty solution is to utilize the pdftk command line PDF processor and call it from within your PHP code using the exec() function. The pdftk command has many features and concatenating files is only one of them, but it does an awesome job. Depending on your hosting situation, this may or may not be an option for you.
The other option would be to use FPDI to import the two PDF files and concatenate them within your PHP code and then send the concatenated version to the user.
More information on using PFDI here:
Merge existing PDF with dynamically generated PDF using TCPDF
Given that you're already using TCPDF, importing the pre-existing file that you want to concatenate with the one you've just created shouldn't be too difficult.
Just add FPDI to your project/composer from:
https://www.setasign.com/products/fpdi/downloads/
Can you still used tcpdf.
FPDI support all the methods of tcpdf, just used new FPDI() instead new tcpdf() the result will be the same in your report, after you create your report marge the files with the code from this page:
https://www.setasign.com/products/fpdi/about/
In a loop, once set the first file and after this set the second...
If you will need help i am here for you.

get folders of a folder in one drive pro (sharepoint) rest api

I am trying to get a list of folders underneath my documents folder using the sharepoint rest api. This seems like it should be very simple but I am having a hard time seeing how to do this from the documentation.
I want to determine if the following folder exists:
[https]://[Site]/personal/[Path to User]/Documents/test
I tried:
[https]://[Site]/_api/web/GetFolderByServerRelativeUrl('/Documents')
gives 'file not found', I would expect to get some json returned that gives me file information etc, how do I determine if the /Documents/test folder has been created with the rest api?
I believe you should try it like this:
[https]://[Site]/_api/web/GetFolderByServerRelativeUrl('Documents')/folders
This should give a list of all of the folder underneath your documents library.
Hope this helps.
Web.GetFolderByServerRelativeUrl method accepts serverRelativeUrl parameter that specifies the server-relative URL for the folder.
Examples
For location:
[https]://[Site]/personal/[Path to User]/Documents
the following REST requests return folder object:
[https]://[Site]/personal/[Path to User]/_api/web/GetFolderByServerRelativeUrl('/personal/[Path to User]/Documents')
or
[https]://[Site]/personal/[Path to User]/_api/web/GetFolderByServerRelativeUrl('Documents')
Note: relative Url to Documents library is specified (not starts with / like in your example)
Please check it your url is valid like and check the url of your document library :
[https]://[Site]/Documents
In your case it should be like, if its Documents library:
[https]://[Site]/_api/web/GetFolderByServerRelativeUrl('/Shared%20Documents')
Or Write full relative path of your URL like
[https]://[Site]/_api/web/GetFolderByServerRelativeUrl('/personal/[Path to User]/Documents/test')