LibreSign / libresign

✍️ Nextcloud app to sign PDF documents
https://libresign.coop
484 stars 55 forks source link

Automation using the API? #3661

Closed chgayot closed 1 month ago

chgayot commented 1 month ago

Awesome work Libre Team, that's a project that should be funded!

Is your feature request related to a problem? Please describe. I'm looking into having some automation scripts that automatically request signatures (with their placement). Could we do this remotely using the API? By default, Nextcloud sends me a 404 on the API endpoint, is it designed only to be an internal API or could we make it external? If so, what would be the process? Couldn't find this in the docs.

vitormattos commented 1 month ago

The API can be used, without any problems. Some of our clients already use it this way.

You can see the API documentation by installing the app https://apps.nextcloud.com/apps/ocs_api_viewer

We don't have updated documentation for all the requests, other than the API documentation itself, but if you open the Developer Tools in your browser (press F12) and look at the Network tab, you will see all the requests that are in the API being used in practice.

Access to the API is the same for any Nexcloud API endpoint, a perhaps simpler way is to use the Authorization header with an access token for the user who will be the one requesting the signatures.

Oh, and we would be very happy to receive recurring support for LibreSign :-D Currently, the perhaps simplest way we have to do it is via GitHub sponsor

chgayot commented 1 month ago

Thanks @vitormattos , don't know why I thought it was a different server running it.

And the tip to look for the API calls is indeed very good, I was a bit lost crossing the incomplete docs given by the OCS API viewer with the official one that's full - at least I know the flow now if anyone wants to kickstart their journey:

  1. Create your example with the network viewer by listing down requests and responses
  2. If necessary, create a working header with the OCS API viewer to make sure you can access the API from where you'll use it. 3. Adapt your “example” based on the official API https://libresign.github.io/api/ Edit: 3. Adapt your “example” based on the OpenAPI doc in the OCS API viewer

I'll write a quick blog post about the super simple automation I'm working on.

vitormattos commented 4 weeks ago

This documentation is outdated:

Adapt your “example” based on the official API https://libresign.github.io/api/

I need to disable this website. I stopped to update this and now the OpenAPI documentation stay available by ocs_api_viewer app.

Use the app OCS API Viewer https://apps.nextcloud.com/apps/ocs_api_viewer

vitormattos commented 4 weeks ago

I will like to help you doing review and contributing with your post.

chgayot commented 4 weeks ago

This documentation is outdated:

Oups^^ I used it to find a lot of optional field, for e.g. the displayName in the users array for "request-signature"

I will like to help you doing review and contributing with your post.

Muito obrigado, will let you know when I make some progress with it!

vitormattos commented 3 weeks ago

@chgayot please, could you check if this help you?

Have anything else to add to this article?

If you wish to contribute, you can send your review to this PR: