lordofallcubes
Cadet
- Joined
- Feb 9, 2021
- Messages
- 1
Hello all, let me start by acknowledging that there is a "solved" thread that touches on this subject, but it was not useful and its title is not ideal for the conversation.
Context
As the title explains, I am trying to unlock a dataset via the API 2.0--and it is not working. The documentation seems very confusing to me, but it may be inexperience understanding REST APIs.
I am playing around with some ideas that I think are cool, and for them I definitely need a passphrase-encrypted dataset and the ability to unlock it from the API.
Problem details
I'm trying to use the `https://my_server/api/v2.0/pool/dataset/unlock` endpoint, and having difficulties. Below is the code I'm using (removed checks and such for brevity), and I've also tried using curl.
I get a status code of 200, and the body contains some number (e.g., 600) that increases every time I try to run this endpoint. As long as I keep the structure of the json valid (keys are expected keys), I can fill the rest with any garbage and I get the same result.
Thoughts
I don't use REST very much, but it seems quite strange to me that i get a 200 code and absolutely nothing happens; I don't even get any feedback on why nothing happens.
I also find it weird that I had to go into the code to actually understand how I am supposed to structure the body to put my passphrase and such--the documentation was useless here. Again, maybe for REST users it is sufficient. Is the API stable for general use? Should I not be using it?
I appreciate any thoughts on this issue, or generally on why the API seems so...unhelpful to me (am I doing something wrong).
Thank you for reading and any thought you may put into this!
Context
As the title explains, I am trying to unlock a dataset via the API 2.0--and it is not working. The documentation seems very confusing to me, but it may be inexperience understanding REST APIs.
I am playing around with some ideas that I think are cool, and for them I definitely need a passphrase-encrypted dataset and the ability to unlock it from the API.
Problem details
I'm trying to use the `https://my_server/api/v2.0/pool/dataset/unlock` endpoint, and having difficulties. Below is the code I'm using (removed checks and such for brevity), and I've also tried using curl.
Code:
{ import requests import json s = requests.Session() s.headers.update({'Content-Type': 'application/json'}) s.headers.update({'Authorization': 'Bearer 1-**MY_API_TOKEN**'}) d = json.dumps({ 'id':'my_pool/my_dataset', 'unlock_options' : { 'recursive' : True, 'datasets' : [ {'name' : 'my_pool/my_dataset'}, {'passphrase' : 'hello_world'} ] } }) r = s.post('https://alexandria/api/v2.0/pool/dataset/unlock' , verify=False , data=d) }
I get a status code of 200, and the body contains some number (e.g., 600) that increases every time I try to run this endpoint. As long as I keep the structure of the json valid (keys are expected keys), I can fill the rest with any garbage and I get the same result.
Thoughts
I don't use REST very much, but it seems quite strange to me that i get a 200 code and absolutely nothing happens; I don't even get any feedback on why nothing happens.
I also find it weird that I had to go into the code to actually understand how I am supposed to structure the body to put my passphrase and such--the documentation was useless here. Again, maybe for REST users it is sufficient. Is the API stable for general use? Should I not be using it?
I appreciate any thoughts on this issue, or generally on why the API seems so...unhelpful to me (am I doing something wrong).
Thank you for reading and any thought you may put into this!