Building SDKs for your SAAS

dviejopomata

Dviejo

Posted on November 13, 2018

Building SDKs for your SAAS

Building SDKs for your SAAS

I recently build a service, docxmerge, which does a merge from a Microsoft Word and JSON document and converts it to PDF.

The API is very simple, but in order to make easy for developers to integrate it in their applications, I chose to create a library for at least four languages, NodeJS, Dotnet, Java, and Python.

Yeah, it looks like we got a bit of work. This task can be either too easy or too embarrassing. But I had a benefit, which was to use Swagger for the API definition, so basically, I could generate all the boilerplate code and just do a class in every language and publish it to the corresponding registry.

With Swagger, all is based on the JSON generated in the backend in this case the next one:

https://api.docxmerge.com/api/swagger/v1/swagger.json

Having that JSON, the swagger codegen is able to generate the code to interact with your api in a typed way and with no effort at all. I generate that code with docker which is much cleaner:

docker run --rm --network=host -v ${PWD}/src/swagger:/local swaggerapi/swagger-codegen-cli:v2.3.1 generate -i ${SWAGGER_URL} -l typescript-node -o /local --additional-properties supportsES6=true

As a said, Swagger was the biggest advantage, as it was effort free and I didn't have to worry about paths, query strings, multipart requests, etc. And lucky me, I was able to generate it from C# annotations using this Swashbucle library , so didn't have to write that mega JSON ;)

I will do one post per language explaining how I built each library from the swagger-codegen to the publish.

This is the repository where I'm working:
https://github.com/Docxmerge/docxmerge-sdk

It's still in progress, and I'm still missing the Java one to be deployed because of the verification, but it works.

💖 💪 🙅 🚩
dviejopomata
Dviejo

Posted on November 13, 2018

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

Building SDKs for your SAAS
dev Building SDKs for your SAAS

November 13, 2018