Dropbox core api: is rev unique? - dropbox-api

I am using the dropbox core api currently.
For each object, I tried to use the rev value as the uri.
However, from the document of dropbox and result of google, I am not sure whether the rev is a unique number or not.
file.rev // and results is something like: 7e91b4dee3f
Can anyone confirm this?
Great Thanks~

Unique across what? It uniquely identifies a revision of that file.

Further info on this from Dropbox:
"The rev value uniquely identifies the file in the Dropbox, including path, so you don't need to add a path too."

Related

Clio API v4; Endpoint for getting list of documents within one folder

Problem: Getting a list of documents that exist in a specific folder
Tried solution:
endpoint /api/v4/folders/list.json seems to be working exactly the same as /api/v4/folders.json
Something similar to this - similar endpoint doesn't seem to exist
Filtering documents by parent_id, however this functionality doesn't exist
Is there some kind of example of the endpoint to perform such operation?
Reading the documentation, it appears as though /api/v4/folders/list.json returns the contents of a folder. If you are trying to get a list of all the documents within the folder 1425540709 (using your example above) then your GET would add a parameter "parent_id = 1425540709". According to the documentation, if you don't send a "parent_id" it defaults to the root folder for the account.
Your request url should look like this I believe:
https://app.goclio.com/api/v4/folders/list.json?parent_id=1425540709&limit=25
The response will be a json array of the items within that folder.
Make sure you send it a parameter for what fields you want back too because otherwise the api defaults to just id and etag.

How can I update Customer metadata in stripe? [.NET]

In stripe.net documentation, I could only find how to update the customer. I'm not sure if I could update a certain metadata of a customer this way.
Anywhere in documentation I can study from?
So I found out that overriding the meta with original dictionary items with changed values actually does the job.

REST API with segmented/path ID

I am trying to design a REST API for a system where the resources are essentially identified by path-like addresses with varying numbers of segments. For example, a "Schema" resource could be represented on the file system as follows:
/Resources/Schemas/MyFolder2/MyFolder5/MySchema27
The file-system path /Resources/Schemas/ is the root folder for all Schemas, and everything below this is entirely user defined (as far as folder depth and folder naming). So, in the example above, the particular Schema would be uniquely identified by the following address (since "MySchema27" by itself would not necessarily be unique):
/MyFolder2/MyFolder5/MySchema27
What would be the best way to refer to a resource like this in a REST API?
If I have a /schemas collection my REST URL could be:
/schemas/MyFolder2/MyFolder5/MySchema27
Would that be a reasonable approach? Are there better ways of handling this?
I could, potentially, do a 2-step approach where the client would first have to search for a Schema using the Schema address (in URL parameters or in the request body), which would then return a unique ID that could then be used with a more traditional /schemas/{id} design. Not sure that I like that, though, especially since it would mean tracking a separate ID for each resource. Thoughts? Thanks.
The usual way to add a resource to your "folder" /Resources/Schemas/ is to make a POST request on it with the body of this POST request containing a representation of the resource to add, then the server will take care of finding the next free {id} and and setting the new resource to /Resources/Schemas/{id}.
Another approach is to, as you said, make a GET request on /Resources/Schemas/new which would return the next free {id}, and then, make a second request PUT directly on /Resources/Schemas/{id}. However this second approach is not as secure as the first since two simultaneous request could lead to the same new {id} returned and so the second PUT would erase the first. You can secure this with some sort of reservation mechanism.
This is called as Resource Based URI approach for building REST services . Follow these wonderful set of video tutorials to understand more about them and learn how to implement too . https://javabrains.io/courses/javaee_jaxrs

couchdb, how to rename an attachment

I'm writing cms like application and I would like my images to be stored as attachments in couchdb.
The problem is in naming the attachments because I don't want my images to be named the same (e.g. /db/doc_id/thumb.jpg)
Ideally attachments names should depend on doc.name field. To make this work I would have to rename attachment each time user changed the name (description|alt) of current photo document.
So my question is: how to change attachment name? or maybe I should go other way in solving my problem?
Szymon,
I'd suggest considering using UUIDs for the document names, and storing the attachment as something "static" like "original", "thumb", "300wide", etc. The name given by the user when they upload the file can be stored as a key, and you can use a MapReduce index to retrieve the image/file using that name later.
If you go that route, though, you'll have to come at the "duplicates" problem a bit differently--as you could easily upload the same image multiple times with the same user-provided name and there would be no conflict.
Depending on what you're building, though, making the user provide a unique name is generally unwise--Flickr (among many others) doesn't, for instance.
If you really do need to make the doc_id == the name given by the user, then it would still be wise to store the attachments under static names, so you don't have to update the attachment name.
Lastly, if you feel you really must change the attachment name (and there are certainly cases where you need to), the simplest way is to GET the attachment from the old location (or with the document), PUT it as the new name, and DELETE the attachment with the old name.
Hope that helps!
Use this command >
curl -v http://localhost:5984/database/DocumentID/OldFileName?rev=RevisionID -X MOVE -H "Destination: NewFileName"

How can I delete all values from SFHFKeychainUtils?

For deleting a value from keychain following code is available:
[SFHFKeychainUtils deleteItemForUsername:XYZ andServiceName:#"known" error:&err]
Is there any way to remove all stored values in keychain using only service name ?
My problem is that my key value is dynamic in nature. It's truly possible that I don't know XYZ value when I will run App second time. There is a case where I have to remove all values stored in known service.
How can i remove all value if I don't know XYZ ?
In my honest opinion there is no api call provided by SFHFKeychainUtils by which you can delete all entries at once and as you might be knowing that iOS keychain only allows you to delete those entries which belong to your applications (sandbox rule coming in play here) , so if you wish to delete all entries for your application then I would suggest you keep track of all the usernames in a file in documents directory or NSUserDefaults so that you can delete them one by one.. hope this helps.