Library for Golioth REST API (preferably Python)?

I’m putting together a little code widget involving the Golioth REST API. Does there happen to be a library that is already written to make this easier? Ideally it would be in Python with as few "pip install"s as possible.

I’m basically starting to write one myself, but it would be great to see if there’s a more complete one already written.

Hi @sethkazarians! We don’t have an officially supported Python library, but there is a nascent one used for testing in our Zephyr SDK: golioth-zephyr-sdk/scripts/python/golioth at main · golioth/golioth-zephyr-sdk · GitHub

You could also use something like GitHub - openapi-generators/openapi-python-client: Generate modern Python clients from OpenAPI to generate a client from the OpenAPI specs we provide at Open API Docs | Golioth.

Thanks for pointing me in that direction.

The OpenAPI generator would be the way to go. However, it looks like the one you linked doesn’t support Swagger. (The repo readme makes a mention of “This generator does not support OpenAPI 2.x FKA Swagger. If you need to use an older document, try upgrading it to version 3 first with one of many available converters.” But none of the converters I’ve found online will take the json found at https://api.golioth.io/swagger.json and output anything different.)

Is there a converter you’re using that will work? Or is there another API document that conforms to OpenAPI 3?

@hasheddan Could I get some help on this? If you have a converter that you’re using, that would save me a bunch of time. Or if there’s something fundamental I’m missing, please let me know.

@sethkazarians apologies for the delay here! I was able to use the converter at https://editor.swagger.io/ to convert the Swagger definition at https://api.golioth.io/swagger.json to OpenAPIv3. The steps I used are as follows:

  1. Copy the Swagger definition into the editor.
  2. Go to Edit > Convert to OpenAPI 3
  3. Go to File > Convert and save as JSON

Let me know if that doesn’t work for you. I’ll follow up with any updates around serving the OpenAPIv3 schema and the potential for a Python SDK.

1 Like

@sethkazarians I wanted to follow-up here to let you know that we are now also serving the OpenAPI v3 schema at https://api.golioth.io/openapi.json. Let me know if there is anything else we can do to be helpful!