Hello guys,
I am working for a company which is using Resin and I am the main developer using your API(https://docs.resin.io/reference/data-api/) and the python-sdk package(https://docs.resin.io/reference/sdk/python-sdk/). I have some questions regarding the API. Why are there so many missed endpoints? For an example: I cannot reach tags directly from API but from the SDK I can. Also I cannot get all devices environment variables for a given application. Let me tell you what am I doing. I made a small serverless flask application deployed as a lambda function which is contacting Resin for getting device statuses. I tried with the SDK but there are some problems with deploying it as a Lambda function and it’s very slow. Are you caching the things up with the SDK? Are you going to expand your base API? Cheers
Hi alovbg,
the main issue is that the documentation for the data API is a bit lagging behind and describes an older version than the one that is currently supported in the SDK.
We are working on improving the API docs and bringing them up to date. What kind of issues are you experiencing with the SDK on aws, the overhead of using the SDK versus querying the data API directly should not be that significant?
Hi nazrhom,
Thanks for responding to my post. The difference is really big. For an example, getting all devices with the api is taking 1 second to load all and the from SDK it’s taking me over 2seconds which is a difference when I am using it in my API. BTW I was going to raise an issue in github for this, but what is the status with the environment variables right now? I have a problem getting them both types - service and device variables from the python-SDK version 4.2.0(I tried also with 4.0.0 same issue):
endpoint=self.settings.get(‘pine_endpoint’)
File “C:\Users\BOGDAN~1\Desktop\data\test\lib\site-packages\resin\base_request.py”, line 178, in request
raise exceptions.RequestError(response._content)
resin.exceptions.RequestError
I am reproducing it on Linux and Windows machine. Working with the environment variables is from big importance for my company. I am using an older version of the sdk (2.1.0) which is getting only the service environment variables.
Thanks in advance,
Bogdan
Hey Bogdan,
Can you please check if the sdk config file uses correct API version? If you uses Python SDK version 4.x.x then it should point to API v4. Since we don’t update the config file if it does exist so you need to manually change the API version when upgrading SDK version.
About the performance issue, the SDK does some background checks (like validate your credentials…) before sending any request so it will be a little slower in comparison with sending the request directly to the API.
Hi nghiant2710,
I am doing this with a virtual environment. I tried with installing it from git - still no luck. I checked up the version, it was already v4. Do you have any other suggestion?
Thanks,
Bogdan
hey Bogdan,
To investigate the issue, can you share with us what’s Python SDK version you’re using, the config file and the code to read both type of variables please?
Hello again,
I was looking at the wrong configuration file. It was v3 instead of v4. Sorry about all the noise I made on this one. I just realised that we cannot access the device enviroment variables, I see endpoints only for the service ones. How are the device ones reachable?