Was this page helpful?

Set Tags

    Description of the code sample

    The following code example sets the tags on the page called "Page Title".  A tag of each type is used (date, define, and text):

    Sample Code

    Plug p = Plug.New("http://deki-hayes/@api/deki");
    p.At("users", "authenticate").WithCredentials("admin", "password").Get();
    XDoc tagsDoc = new XDoc("tags")
        .Start("tag").Attr("value", "date:2007-08-29").End()
        .Start("tag").Attr("value", "define:this tag is a define").End();
        .Start("tag").Attr("value", "text tag").End()
    p.At("pages", "=Page_Title", "tags").Put(tagsDoc);

    Sample Response from executing Code

    <tags count="3" href="http://deki-hayes/@api/deki/pages/31/tags">
        <tag value="text tag">
            <type>text</type> 
            <uri>http://deki-hayes/Special:Tags?tag=text+tag</uri> 
            <title>text tag</title> 
        </tag>
        <tag value="date:2007-08-29">
            <type>date</type> 
            <uri>http://deki-hayes/Special:Events?from=2007-08-29</uri> 
            <title>Wednesday, August 29, 2007</title> 
        </tag>
        <tag value="define:this tag is a define">
            <type>define</type> 
            <uri>http://deki-hayes/Page_Title</uri> 
            <title>this tag is a define</title> 
            <related count="1">
                <page id="29" href="http://deki-hayes/@api/deki/pages/29">
                    <title>DekiWiki (Hayes)</title> 
                    <path /> 
                </page>
           </related>
        </tag>
    </tags>

    Implementation notes

    Was this page helpful?
    Tag page
    You must login to post a comment.

    Copyright © 2011 MindTouch, Inc. Powered by