# Can I get Databin ID from its name?

I am trying to create databins of dynamics names. But seems that I can only call databin through its shortID, wondering if there is any method to get a databin ID from its name?

CreateDatabin["name"->"testName"];
Databin[?"name"=="testName"] or some thing like that?


A second related question is how can I test if a databin of a certain name already exists, and if yes, how to get its short ID?

Thanks

You could create a mapping between the Name and the ShortID of the Databins. E.g.

myBins= Databins[];

nameToIdMapping[bins_List] := <|#["Name"] -> #["ShortID"] & /@ bins|>;
binId= nameToIdMapping[myBins];


Then use the mapping when you want to access a specific bin through its name. For example, I have a Databin that collects the credits for an Einstein@Home project.

binId["einsteinAtHome****"]


The second part of your question is then to check the whether a name is part of the Keys for the mapping

MemberQ[Keys@binId, "einsteinAtHome****"]

• Thanks for your answer, but this solution is not the most desired for my case. Because it will be a API function, some call may just create a new databin, where another call is checking if it already exisits. Your solution is more for single thread situation. The best solution for my case is the internal function that allows me to search Databin by name. – user1470393 Jan 25 '19 at 15:49
• Ok, will use it as a protected static variable before APIfunction. Thanks for your solution – user1470393 Jan 26 '19 at 15:52