DocuSign Integration Into FileMaker - docusignapi

The basic work-flow I am trying to implement is to generate a PDF from FileMaker data, upload it to DocuSign for signing, and download the signed document back to FileMaker.
The DocuSign API requires custom headers, so I cannot use the built-in FileMaker 13 Insert From URL script step. Instead, I am using the BaseElements plug-in BE_HTTP_Set_Custom_Header and BE_GetURL functions. I currently have the DocuSign Login API call working.
Now I am trying to use the DocuSign API to upload a document and request a signature. This requires a multi-part/form-data POST request. Unfortunately, neither the BaseElements nor Troi URL plug-ins support multipart/form-data. In fact, I cannot find any plug-in that does. Is anyone aware of a FileMaker plug-in that supports multipart/form-data POST?
https://www.docusign.com/developer-center/quick-start/request-signatures
According to a comment on the Goya support forum last week, the next version of the BaseElements plug-in should support pass-through to the curl command line utility. If true, then as an alternative it seems possible to write a curl command to build the proper request, but my HTTP and curl knowledge is limited. So far, I have been unable to get the DocuSign signature request example working in Terminal. Has anyone been able to upload a document and request a signature with a single curl command?
http://support.goya.com.au/discussions/free-baseelements-plugin/1088-be-plugin-and-http-file-upload
Finally, I would be grateful for any other ideas or suggestions for attacking this problem.
Thank you!

Yoo could use ScriptMaster and Groovy to write your own function to support the multipart/form-data type

It took me a whole week but I managed to get it working on FileMaker 14.
It took me a whole week but I did manage to integrate it completely. I studied with my CEO the various providers out there and we ended up choosing DocuSign because our clients would be able to sign/approve our Estimates from literally any device (and also providing us with some more information if we need) such as Credit Card and etc), and because the annual costs were very competitive.
On the Development side it was hard, but not impossible.
The steps to master it are as follows:
1 - Study REST, and HTTP requests fundamentals (two youtube videos will do the trick).
2 - Get familiar with the command Curl in order to make POST and GET requests from Terminal (on Mac). Once you get to this point. Then you can try to follow Docusign's steps to POST and GET from Mac Terminal (not through FileMaker as yet). The first command that worked for me is as follows:
curl -i -H "Accept: application/json" -H 'X-DocuSign-Authentication:{"Username": "myemail#hotmail.com","Password": "mypassword", "IntegratorKey": "fae5e715-dec2-477f-906e-b6300bc9d09a"}' -X GET https://demo.docusign.net/restapi/v2/accounts/8aabdb38-41ab-4fab-bae9-63a071394a7a
If you replace the text above in bold with your DocuSign Developer credentials/information you should get a HTTP Header 200 OK - which means that you are in the right way.
This is important because you need to understand what information should be in the Headers, allowing Docusign to accept your requests.
3 - Translate the same concept into FileMaker. This is the most tricky part. First you need to create two Custom Variables. One will be your Docusign authentication (email, password and Integration Key). Something like this:
enter image description here
and the other one will be your endPoint , which is simply your Docusign url followed by your account number.
enter image description here
4 - Now you need to install BaseElements plugin onto your FileMaker Database(you wouldn't need this if you were using FileMaker 16). This will allow you to send POST, GET, DELETE, and UPDATE requests to Docusign. Unfortunately BaseElements's documentation is not super so I struggled a little bit till a get an actual result, but I will try to break it down for you here.
In order to make a GET request similar to the example that we have made we need to make a one line Script which looks like:
enter image description here
and then, inside the Refresh Object function:
enter image description here
This Script was adapted from a BaseElements plugin used to do Vimeo HTTP GET Requests - please see the link for more details on how to use it and test it: FileMaker REST using BaseElements Plugin - ISO FileMaker Magazine .
I think this gives you pretty much a good idea of how it works.
Unfortunately Docusign still doesn't provide any documentation or support to FileMaker developers, and this is as far as the internet goes. So if you need to make POST requests, it will get a bit more complex since you will have to put your FileMaker fields in JSON format, BaseElements POST syntax changing the script from GET to POST accordingly and POST inserting one more command with your data:
// insert this on your FileMaker POST script after the Headers List end
~data = BE_HTTP_POST ( ~endpoint ; "{
\"documents\": [
{ all of your JSON code adapted to FileMaker }]}");
You will also have to turn the PDF files that you want to send into Base64 format.
If you do this trick you will be good to go.

Related

Save column of numbers from url to python array

I want to save the data column from this url to an array in python. I tried it with, for instance, pandas.save_table:
import pandas as pd
pd.read_table('https://adventofcode.com/2019/day/1/input', sep='')
but I get HTTPError: HTTP Error 400: Bad Request and I think this is not the right way to do that.
Can someone help me with that?
If you try to open the link in your question (in a browser using incognito mode or something similar i.e. delete your cookies) you'll see that you need login into the website to access the page. This is why the you're getting a 400 Bad Request error as a response from the server.
From the FAQ section of the website that you're trying to access:
How does authentication work? Advent of Code uses OAuth to confirm
your identity through other services. When you log in, you only ever
give your credentials to that service - never to Advent of Code. Then,
the service you use tells the Advent of Code servers that you're
really you. In general, this reveals no information about you beyond
what is already public; here are examples from Reddit and GitHub.
Advent of Code will remember your unique ID, names, URL, and image
from the service you use to authenticate.
The website uses OAuth to handle logins to the url that you create will need these access tokens. You can use a library like python-oauth2 to help you with this (there are others so you can read around and decide which you'd like to use). Creating and understanding how to make http requests is beyond the scope of this answer. I'd suggest you have a look around on the internet for some explanations and try again, if you have get stuck please ask another question. Otherwise it'll probably be easier to save the file from your browser...But I'll leave this answer here for the next person who runs into the same problem.

Python: adding comments to specific cell using Drive API

I am trying to automate some simple updating of a Google spreadsheet and I'm using the gspread library to do so. One task that is critical and not currently supported by gspread is the ability to add comments to a specific cell (there's an open issue for this and even a gist solution but I was getting a 404 error when trying to use it).
I know that the Google Drive API (v3) supports adding comments as described here, but I'm having issues with authenticating and could use some help.
What I have/know:
I have already setup the OAuth 2.0 and registered for the API through Google, as well as have the client_secret.json in my directory, but my knowledge of web requests and responses is limited so going through the Drive API documentation hardly makes sense. I know in order to create the comments I will have to make use of anchors and specify the cell location using column/row numbers.
What I'm stuck on:
When using the Google API Explorer, I'm getting a 400 error with the message: The 'fields' parameter is required for this method. How can I make the POST request using my authentication? I think from there I'd be able to actually add the comments myself.
I'm getting a 400 error with the message: The 'fields' parameter is required for this method
The error is asking for a property which you want returned (these properties are listed in Drive API files resource).
You can just place ' * ' to indicate you want it to return a complete response. That's the quick fix.

Loopback - get list of API endpoints via REST

Loopback has nice documentation which you can view at
http://<your-domain>:<your-port>/explorer
I want to write some tests for our server, and at the very least do a GET request for each of the endpoints that should be public and available over REST.
Loopback explorer clearly has this information somewhere - is there a way to get a list of endpoints programmatically?
I just want something like this list:
PATCH /ServicecontractViews
GET /ServicecontractViews
PUT /ServicecontractViews
POST /ServicecontractViews
PATCH /ServicecontractViews/{id}
GET /ServicecontractViews/{id}
HEAD /ServicecontractViews/{id}
GET /Notes/{id}
HEAD /Notes/{id}
PUT /Notes/{id}
DELETE /Notes/{id}
GET /Notes/{id}/exists
is it possible to get this information programmatically (while the server is live)?
The LoopBack explorer uses Swagger JSON to generate the UI you see.
If you watch the XHR requests using your browser debugger, you can grab the direct URL to the raw Swagger. This data should contain what you need, though not in quite as concise a format as you probably want.

Posting Blog Entries to a Community

Our tool is submitting blog entries to the idation blog for a configured community by using the Connections API.
Therefore, I use the following workflow, given only a community ID:
1) query /blogs/api/blogs?commUuid=<ID_HERE>&blogType=ideationblog
2) retrieve the link to the communities ideation blog from the xml result of aboves query. the xPath for this is "/app:service/app:workspace/app:collection[a:category[#term='entries']][1]/#href"
3) post the created blog entry payload to this url.
This all worked fine in our environment. However, when I deployed this at a customer, it did not work anymore. The url from the first step returns an empty xml document, and the following steps thus cannot be executed. I tried to query different urls on the customers server like /blogs/{homepageHandle}/api/blogs?commUuid=&blogType=ideationblog which work fine, however the query to the api service document above is the only one which contains the collection element with the link I need.
Is there any other API call I can do, to get this url? Do you know of any reason, why the call is working just fine in our environment, but fails at the customer? Might this be an access rights problem?
I am aware, that I could probably just create a url like "blogs//api/entries" and post to it, however I would prefer the above way, since I only have the communityUuid configured, and also because it is exactly the way that the API Documentation describes:
http://www-10.lotus.com/ldd/appdevwiki.nsf/xpDocViewer.xsp?lookupName=IBM+Connections+4.5+API+Documentation#action=openDocument&res_title=Creating_blog_posts_ic45&content=pdcontent
ServiceDoc -> Collection -> href
UPDATE:
This might be a problem with the SBT really. My assumption, that an empty xml document was returned was wrong, it is rather that calls via the SBT Endpoint classes are returning null.
Endpoint endpoint = EndpointFactory.getEndpoint("connections");
Object result = endpoint.xhrGet("/blogs/api"); // also tried for /blogs/<homepage>/api
When I again tried those URLs in the Browser, I got the complete results. Problem with all this is, that I can neither reproduce this in our own environment nor am I able to debug this at the customer. I tried to catch possible exceptions from this, but none are thrown. It's just that the result is null.
To clarify: The same requests work perfectly fine in our own (Connections 4.0) environment, and also from the browser at the customer. I am of course using the same user to authenticate as well in the browser as in the API calls.
endpoint.isAuthenticationValid();
also returns true, so seemingly no problem there...
I have long ago given up trying to follow the IBM documented REST API instructions (not least of all because it always ends in a myriard of REST requests just to get to the URL I need to send my request to).
I tried both your URLs (/blogs/api/blogs?commUuid=... and /blogs/<homepage>/api/blogs...) against all our Connections 4.5 systems, but although I do get an xml document back it doesn't contain a reference to the ideationblog anywhere (and yes, I made sure to quest against a Community that does contain an ideation blog).
This is a dirty workaround, which you mentioned you did not want to do, but which I do use because the documented way doesn't work:
To post blog entries, you need to POST against
/blogs/<bloghandle>/api/entries
To find out the handle (<snx:handle>) of the ideation blog in your community, you can do the following:
1.) Get the widgets-feed for the community: /communities/service/atom/community/widgets?communityUuid=...
2.) Navigate to the entry of the Ideation Blog widget: <snx:widgetDefId>IdeationBlog</snx:widgetDefId>.
Unless someone in your customer system has messed with the widgets-config.xml, the widgetDefId will be IdeationBlog.
3.) Take the <snx:widgetInstanceId> text of the Ideation Blog entry.
That is the handle of your ideation blog. (Yes, community ideation blogs are created with the widgetInstanceId of the Ideation Blog widget as handle. Normal blogs are created with some mashup of their title as handle). You can now construct the URL to post the entries to.

How to auto upload and check in the files to sharepoint using curl?

I am trying to upload a file from linux to sharepoint with my sharepoint login credentials.
I use the cURL utility to achieve this. The upload is successful.
The command used is : curl --ntlm --user username:password --upload-file myfile.txt -k https://sharepointserver.com/sites/mysite/myfile.txt
-k option is used to overcome the certificate errors for the non-secure sharepoint site.
However, this uploaded file is showing up in "checked out" view(green arrow) in sharepoint from my login.
As a result, this file is non-existent for users from other logins.
My login has the write access previlege to sharepoint.
Any ideas on how to "check in" this file to sharepoint with cURL so that the file can be viewed from anyone's login ?
I don't have curl available to test right now but you might be able to fashion something out of the following information.
Check in and check out is handled by /_layouts/CheckIn.aspx
The page has the following querystring variables:
List - A GUID that identifies the current list.
FileName - The name of the file with extension.
Source - The full url to the allitems.aspx page in the library.
I was able to get the CheckIn.aspx page to load correctly just using the FileName and Source parameters and omitting the List parameter. This is good because you don't have to figure out a way to look up the List GUID.
The CheckIn.aspx page postbacks to itself with the following form parameters that control checkin:
PostBack - boolean set to true.
CheckInAction - string set to ActionCheckin
KeepCheckout - set to 1 to keep checkout and 0 to keep checked in
CheckinDescription - string of text
Call this in curl like so
curl --data "PostBack=true&CheckinAction=ActionCheckin&KeepCheckout=0&CheckinDescription=SomeTextForCheckIn" http://{Your Server And Site}/_layouts/checkin.aspx?Source={Full Url To Library}/Forms/AllItems.aspx&FileName={Doc And Ext}
As I said I don't have curl to test but I got this to work using the Composer tab in Fiddler 2
I'm trying this with curl now and there is an issue getting it to work. Fiddler was executing the request as a POST. If you try to do this as a GET request you will get a 500 error saying that the AllowUnsafeUpdates property of the SPWeb will not allow this request over GET. Sending the request as a POST should correct this.
Edit I am currently going through the checkin.aspx source in the DotPeek decompiler and seeing some additional options for the ActionCheckin parameter that may be relevant such as ActionCheckinPublish and ActionCheckinFromClientPublish. I will update this with any additional findings. The page is located at Microsoft.SharePoint.ApplicationPages.Checkin for anyone else interested.
The above answer by Junx is correct. However, Filename variable is not only the document filename and the extension, but should also include the library name. I was able to get this to work using the following.
Example: http://domain/_layouts/Checkin.aspx?Filename=Shared Documents/filename.txt
My question about Performing multiple requests using cURL has a pretty comprehensive example using bash and cURL, although it suffers from having to reenter the password for each request.

Resources