Question on Reading Cascade file metadata programmatically in C#
Hi Support Team -
I'm forwarding a question from Slava, one of our developers.
Thanks!
_____________________________________________________________
Rommel Lagman
Developer, I.T. Development Services
AGF Investments Inc.
Tel: 647-253-6908
Email: [email blocked]
From: Slava Naumenko
Sent: July-13-16 2:32 PM
To: Rommel Lagman
Subject: Read Cascade file metadata programmatically in C# ?
Hi Rommel,
I created a project in C# to talk to Cascade web services referencing /ws/services/AssetOperationService. The reference gave a presentation of all web methods as objects in C#.
So far I was able to figure out how to create and update folders and files just using intellisense in Visual Studio and some other stuff. But I got a bit stuck with dynamic metadata.
This is what I got so far:
// Get Cascade file by id
string id = "e4e67962c0a84b696f983e2f68439e3d";
Cascade.identifier wsCascadeFile = new Cascade.identifier();
wsCascadeFile.path = new Cascade.path();
wsCascadeFile.path.siteName = csSite;
wsCascadeFile.path.path1 = csPath;
wsCascadeFile.type = Cascade.entityTypeString.file;
wsCascadeFile.id = id;
Cascade.readResult fileRead = wsCascade.read(wsCascadeAuth, wsCascadeFile);
Cascade.file file = fileRead.asset.file;
// Read custom metadata field
string dynamicFieldValue = file.metadata.dynamicFields..... ?? got stuck here
My guess there should be another web service request for metadata but then how do I get the identifier for that? Or the file object is already loaded with all metadata? Then how do I get a specific field?
Do you know a good reference for my case? Examples in Java will be good too.
Thanks.
Slava
This email message is confidential to the intended recipient and may be privileged. It is intended solely for the addressee. Access to this email by anyone else is unauthorized. Any unauthorized use, dissemination of the information, or copying of this message is prohibited. If you are not the intended addressee, kindly notify the sender by return e-mail and delete this message.
Le pr?sent courriel est strictement r?serv? ? l'usage du destinataire pr?vu. Il peut contenir des renseignements privil?gi?s et confidentiels. L'acc?s ? ce courriel par une personne autre que son destinataire est interdit. Il est aussi interdit d'utiliser, de diss?miner ou de copier ce message sans autorisation. Si vous avez re?u ce courriel par erreur, veuillez en aviser l'exp?diteur et d?truire le message.
Discussions are closed to public comments.
If you need help with Cascade CMS please
start a new discussion.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
1 Posted by Wing Ming Chan on 11 Aug, 2016 12:46 PM
Hi Slava,
I have never worked with Java or C# when dealing with Cascade web services. I just want to point out a few things. First,
file.metadata.dynamicFields
could be null, or an object, or an array. So first you need to test if it is null. If it is not, then test if it is an array of objects. If it is an array, you need to traverse it. When you are down to an object, look at thename
. If thename
matches what you are looking for, then look atfieldValues
. Again, this can be null, an object, or an array. See http://www.upstate.edu/cascade-admin/web-services/api/asset-classes... for reference.Second, you might want to look at my PHP library. Even though you don't want to use PHP, my library will give you a lot of pointers and answer most, if not all, of your questions related to Cascade web services. My documentation site contains even more information.
Third, you can install MAMP on any computer, deploy my PHP library, and use it to write ws programs in PHP. There are many advantages of using my library. It comes with full documentation, tutorials, tons of examples, and a discussion forum.
Four, I plan to deliver a second series of web service tutorials on Google Hangout. We will start with the installation of MAMP and deployment of my library. Let me know if you are interested.
Wing
2 Posted by rommel.lagman on 11 Aug, 2016 02:36 PM
Thanks Wing.
I’ve forwarded your reply to Slava.
Warm regards,
R
3 Posted by Wing Ming Chan on 11 Aug, 2016 05:11 PM
This was posted in Hannon Hill Users Slack, and I am posting it here again:
Some quick references:
1. PHP web service library: https://github.com/wingmingchan/php-cascade-ws-ns
2. Library API documentation: http://www.upstate.edu/cascade-admin/web-services/api/index.php
3. Tutorials: http://www.upstate.edu/cascade-admin/web-services/courses/index.php
4. Google hangout recordings: https://www.youtube.com/playlist?list=PLiPcpR6GRx5cGyfQESK6ZAj4My8r...
5. Examples and recipes: https://github.com/wingmingchan/php-cascade-ws-ns-examples
6. Cascade Web Services Library Support: https://groups.google.com/forum/#!forum/cascade-web-services-librar...
4 Posted by rommel.lagman on 11 Aug, 2016 05:25 PM
Thanks Wing.
Regards,
Rommel