Is it possible to create a Google Document directly from a Template's JSON - google-api

Since the Docs API allows for retrieval of Google Docs via JSON, is there a way to directly inject that JSON data, with alterations, into a new Google Document? I have several Google Documents that are used as templates for contract agreements, and the data points for all the information to be entered into the templates is already pre-stored in a database.
My goal would be to store the template's JSON server-side and call that data to generate a current agreement and modified agreement by iterating through the placeholder values, inserting database / user input values at those placeholders, and then creating a new Google Doc from that JSON that can be downloaded. Skipping the step of creating google-side copies, grabbing their ID's, and calling something like Batch Update
My inspiration for this came from Federico Tomassetti's post: A template system for Google Docs: Google Drive automation and PDF generation with Google Execution API.
However, Federico creates copies of the template and then fills that copy using App Scripts. I'm currently searching for a solution that would allow for Agreements to be fully generated before being inserted to reduce overhead and simplify permissions, etc. Skipping the step of creating copies and then editing.
I'm just surprised there isn't some kind of way to directly upload without having to call a GET to the template every time, creating copies, and then editing those copies via Batch Update. Hopefully I'm missing some API call that exists, but so far I haven't found anything.

Related

Is there a way to programmaticaly upload a whole skill to DialogFlow?

I want to generate the whole action JSONs in code, and then upload them, instead of working through the console.
There is an option to download the whole package as a zipped JSON and theoretically you can also upload. That might supply a hint on how to create the JSONs.
However, these files have all kinds of IDs for the different building blocks, such as Intents or Entity. So, when I export from DialogFlow, of course I get IDs for these.
But, if I want to create a new google action, do I generate these action IDs myself?
Is there documentation on what the structure of these JSONs should be?
The format used by the export/import process is not documented, and while you can try to work with it, there is no guarantee that it will continue to work in the future.
Depending on your needs, it may be better to work with the Dialogflow API (the former API of API.ai). This provides an API to build and modify Intents and Entities (and do some other things). It isn't clear, however, that this provides access to the settings for various integrations.

Use EC2 for PDF Generation, provide public URL to user

I have developed an application which allows Users to select multiple "transactions"; each of this is directly related to a PDF file.
When a User multi-selects them, and "prints" them, these PDF files are merged into one longer file to provide ease of print.
Currently, "transaction" PDFs are generated on request, and so is PDF-merging.
I'm trying to scale this up relaying over Amazon infrastructure, some questions arised to me.
Should I implement a queue for the PDF generation per "transaction"? If so, how can I provide the user a seamless experience? We don't want them to "wait"
Can I use EC2 to generate these PDF files for me? If so, can I provide a "public" link for the user to download the file directly from Amazon, instead of using our resources.
Thanks a lot!
EDIT ---- More details
User inputs some information through a regular form
System generates a PDF per request, using the provided information for the document
The PDF generated by the system is kept under Amazon S3
We provide an API which allows you to "print" multiple pdfs at once, to do so, we merge the selected PDF files from S3, into one file for ease-of-print
When you multi-print documents, a new window is opened which is your merged file directly, user needs to wait around 20ish seconds for it to display.
We can to leverage the resources used to generate the PDFs onto Amazon infrastructure, but we need to keep the same flow, meaning, we should provide an instant public link to the User to download & print the files.
Based on your understanding, i think you just need your link to be created immediately right after user request for file. However, you want in parallel to create PDF merge. I have idea to do that based on my understanding, and may be it could work in your situations.
First start with some logic to create unique pdf file name, with random string representing name of file. And at same time in background generate PDF, but the name of PDF should be same as you created in first step. This will give user instant name of file with link to download. However, your file creation is still in progress.
Make sure, you use threads if using PHP or event loop if using Node.JS to run both steps at same time. This will avoid 404 error for file not found.
Transferring files from EC2 to S3 would also add latency delay. But if you want to preserve files for later or multiple use in future then S3 is good idea as it could simply serve PDF files for faster delivery. As we know S3 is used for static media storage. Otherwise simply compute everything and generate files on EC2

Get CRM WRPC-Token for display images in Webressource

In my CRM HTML-Webresource, I got to display E-Mail activities with it's images (saved as attachments) as HTML. I take the description attribute for that.
As I realized, at least in CRM-Online, every attachment-image has a WRPC-Token that I need for the correct file path to load it.
How can I get the token? Most of the solutions that I found are either old or don't work for my circumstances.
Can I fetch the token out of the given HTML?
This approach doesn't make sense to me,
Attachments are stored within a database behind a web service, they are not at a file path you can simply open.
WRPC-Token's are used in security, I'm not sure how it is relevant or could provide a file path.
I would suggest writing code to access the CRM web services, this will enable you to retrieve the attachment data. There is an example here Sample: Create, retrieve, update, and delete an email attachment.

Oracle UCM - Storing and retrieving document under custom directory

I am new to Oracle WebCenter Content (Formerly known as Oracle UCM).
I am looking from the integration of UCM to third party application perspective only to retrieve and store the document. I have went through the details about WSDL Generator and also collected the set of SOAP API require to perform check-in and other operations.
We are not going to use UCM directly to store and retrieve the document rather from third party application to store and retrieve the documents (PDF). I have following basic set of questions:
Does UCM store my documents under Weblayout directory?
How would I store documents under specific directory using Check-in SOAP API? (I.e. If I want to store document under "IT Department" Directory.) Which field I can use to mention the location in wsdl?
When I search the document, does it return or can I get the location of the document in search result?
OOTB, UCM stores your original doc in the Native directory and a copy in weblayout - converted to web viewable format if you have IBR enabled. Use a storage rule based on the storage rule metadata field to determine where to store docs based on metadata. See more info here.
When executing a search, you should receive back a field DocUrl which contains the URL to the content item. However, this URL can break if certain metadata changes (such as dSecurityGroup or dDocType).
A better idea is to use GET_FILE and either the dID or the dDocName (and RevisionSelectionMethod).
Additional reading on the FileStoreProvider and how URLs are calculated can be found here.

Adding google apps script though google API?

I am writing a program that creates a new spreadsheet, then exports data from our servers to this spreadsheet using Google API. Then the user should edit this data and reupload it back to our server.I would like to add data validations on some fields and also freeze the top row. I understand this can only be achieved through scripts and not though Google Spreadsheet API. My question: is it possible to attach a script when I create a spreadsheet? If not, are there other ways to achieve my goals? Thanks!!!
There's no way to insert or modify any script on an existing spreadsheet via any API.
But there's a good workaround for those who are creating a new spreadsheet, like you. Instead of creating a new spreadsheet you can copy a blank one that already has the desired script in it, effectively creating new spreadsheets with scripts in it.
In your case this workaround may not even be necessary. Scripts attached to any spreadsheet (or site) can open any spreadsheets that you have access normally, they do not need to be inserted on the target document.
So, if all you want to do is some formatting before handling the file to the user, you don't need to insert your script in it.

Resources