How SDK interact with API #176
Replies: 3 comments
-
we do not cache any data from the API other then the DB_schema. |
Beta Was this translation helpful? Give feedback.
-
No, |
Beta Was this translation helpful? Give feedback.
-
HTTP RequestsI think this has more to do with HTTP. HTTP is very simple/bare tool and we utilize it to send GET, POST, or Patch requests to the API.
With the GET requests we mainly utilize URL parameters. With POST and Patch requests we utilize JSON to send data to the API. We utilize a JWT token issued by the API and signed with its cryptographic signature, placed in the JSON header of the JSON request to prove that this request is indeed authenticated and not just anyone unauthorized making requests to our API. After the API processes the data it then responds back with some HTTP status code, hopefully 200 if everything went well and then the JSON representation of what was saved to the database. If something went wrong, then the HTTP status code would give us some clues as to what is the issue and the API will give an error message as well to help us debug the issue with the HTTP request we sent it (mainly what was wrong with out JSON body or any of the headers that we have improperly configured). an API error could look like this: }
"code": 409,
"data": null,
"error": "duplicate item [{'name': 'test_integration_reference_name_068e6295ce8746edb1a4b87f507145b5'}] for Project"
} Packages SDK Utilizes for HTTP RequestsTo send HTTP requests to the API, and then get its response and use it we are using the very popular and well made requests library
requests is pretty much the default package that almost all projects use for sending and receiving HTTP requests ResourcesHere are some possible resources that might be helpful |
Beta Was this translation helpful? Give feedback.
-
What would be the cache and de-cache strategy for SDK interacting with API? I do see a lot of cache, i.e., the request made to API for specific data, but what would happen after such request complete? Would the request data stays open, or it would close automatically? I assume those requests are like "fopen", and do we need to have commends like "fclose" to properly "decache" the data stored at API.
Beta Was this translation helpful? Give feedback.
All reactions