Thank you very much Steve! Everything works fine now.
Im trying to store the properties "name", "playcount", "listeners", "mbid", "url" not the "artist" or the "artists" property. I think that my document class definition is at the bottom of my code :
Class User.API
{
ClassMethod getFile() as %Status
{
IF $SYSTEM.DocDB.Exists("db.Streamingdatabase") {
SET db = ##class(%DocDB.Database).%GetDatabase("db.Streamingdatabase")
}
ELSE {
SET db = ##class(%DocDB.Database).%CreateDatabase("db.Streamingdatabase")
}
DO db.%CreateProperty("Name","%String(MAXLEN=200)","$.name")
DO db.%CreateProperty("Duration","%Integer","$.duration")
DO db.%CreateProperty("Playcount","%Integer","$.playcount")
DO db.%CreateProperty("Mbid","%String(MAXLEN=200)","$.mbid")
DO db.%CreateProperty("Url","%String(MAXLEN=200)","$.url")
DO db.%CreateProperty("StreamableText","%Integer","$.streamable/#text")
DO db.%CreateProperty("StreamableFulltrack","%Integer","$.streamable/fulltrack")
DO db.%CreateProperty("ArtistName","%String(MAXLEN=200)","$.artist/name")
DO db.%CreateProperty("ArtistMbid","%String(MAXLEN=200)","$.artist/mbid")
DO db.%CreateProperty("ArtistURL","%String(MAXLEN=200)","$.artist/url")
DO db.%CreateProperty("Rank","%Integer","$.@attr/rank")
SET httprequest=##class(%Net.HttpRequest).%New()
DO httprequest.Get("http://ws.audioscrobbler.com/2.0/?method=user.gettoptracks&user=ducanhtr...")
DO db.%FromJSON(httprequest.HttpResponse.Data)
}
}
I have a last question
Is it possible to import my collection row by row for like every 5 seconds? I want to create a streaming and always want to refresh my database. I think it's also okay if i can import my whole collection for like every hour. Thank you again in adance.