Json pdf to oracle blob

Hi all,

I’m having an issue getting a pdf from an URL and inserting it into an Oracle database. I’m using REST and connecting and receiving the JSON. I can see the path where the pdf is located(S3.amazon). How do I get this document using NovaCura?

–Tim

1 Like

Hi,

You will have to confirgure a REST connector in novacura in order to retrive the PDF from the 3 rd party application . please refer the link below.

how to set up a REST connector - Getting started - Flow Help (novacuraflow.com)

shyaminda

We have the REST connector setup and working. We have a URL to a PDF file on the internet. How can we get that file into Novacura to do things with it, like save it to a file system, or write a BLOB to the database?

Coworker of @Keyhole here…

We know that Novacura can work with BLOBs, because that seems to be what’s created by the HTML2PDF connector. So maybe the most pertinent question is this:

Within Novacura, how can we convert RAW file data (i.e. the data returned by a GET) into a BLOB?

Tom

Hi,
I do not have a working example against Oracle, but in MS SQL I think you would need to convert it to a binary. Convert(varminary(max), your invariable)

I thought the file connector would be just “write all bytes to file” or “write stream to file” option under the file connector.

Or perhaps I misunderstood, is the question around how you would fetch the binary from the Rest connector?

1 Like

Hi,

i one of our previous PoCs we were generating and then fetching documents from an online shipping (REST) service and attaching them to IFS (storing them as oracle blobs) via Flow.

In our case, the online documentation for that REST service told us that the document itself will come as a (Base64) string. So we were taking that data and just assigning it to a blob type variable and then using it in a procedure call.


Also when using HtmlToPdf connector the result is a record with data column (that is a binary stream)
We use the same procedure for attaching to IFS by just assigning that column to a blob variable and then using it in a procedure call.

So i would say that the blob data type, when used within a machine step, is quite… accepting when it comes to contents and that no conversion is needed most of the time :slight_smile:

Hope this helps!

B R
Ivan

2 Likes

Hi!

Very curious in how you achieved this conversion from a base64 string to a binary blob.
I have tried this in different ways but have not been able to get it to work…

How do you perform the conversion from base64 to binary?

Best Regards
David

Hi @davidg ,

As far as I know there’s no support in Flow to decode Base64 into binary, only to text. We’ve done decode to binary in projects by using a custom connector. In one customer solution we use Flow as an API for different integration scenarios, one being upload file to IFS. That API method takes a WoNo and Bas64 binary string as a parameters and check in the document to IFS DocMan and connects it to a work order.

Developing custom connectors will require some .NET knowledge. Here’s the help section on custom connectors: Custom .NET - Flow Help.

Hi, ivstde.

I’ve been trying for awhile now to get this .pdf into IFS and I’m not having any luck. Here’s the error that I am receiving.

I’m trying to get the URL for the JSON:

This is the string from PostMan:

image

Seams like you are referencing the URL string in your PL SQL block. IFS is expecting a binary. You need to do a second call to fetch the binary data from that URL before using it in your script.

Hi @Keyhole ,
its like Albin said, your rest call gets you a URL to file (a regular string) so you would first need to get the binary behind that URL and then assign it to blob variable to save in IFS.
(In our case above we were getting a base64 string)

Its been a while but i seem to remember getting files from urls using PL/SQL (if you are the db admin because it includes setting up ACL and certificate wallet)

I did something similar to this:

And had to set up something similar to this:

I remember i wasn’t happy (with how complex the process was) when i did it :slight_smile:

Not sure if there is an easier way of getting the file behind the URL

Hope this helps

B R
Ivan

Yeah, why not use the Novacura Rest connector? :slight_smile:

Otherwise it could be done via Oracle, but that’s more complicated indeed.

I am using REST.

Good. Setup a subsequent GET call using that URL with a binary response. This can then be used in your PL SQL script.

1 Like