Was this page helpful?

Create a File Property

    Description of the code sample

    The following code authenticates and creates a new file property named 'foo' with a text value. A description of the change is set as well.

    Sample Code

    Plug p = Plug.New("http://devwiki/@api/deki"); 
    p.At("users", "authenticate")
     .WithCredentials("sysop", "password").Get(); 
    p.At("files", "42", "properties")
     .WithHeader("Slug", "foo")
     .With("description", "initial value") 
     .Post(DreamMessage.Ok(MimeType.TEXT_UTF8, "My Value"));

    Sample Response from executing Code

    <property name="foo" href="http://devwiki/@api/deki/files/42/properties/foo/info" etag="4463.r1_ts2009-03-20T22:48:15Z">
      <contents type="text/plain; charset=utf-8" href="http://devwiki/@api/deki/files/42/properties/foo">My Value</contents>
      <date.modified>2009-03-20T22:48:15Z</date.modified>
      <user.modified id="1" href="http://devwiki/@api/deki/users/1">
        <nick>Sysop</nick>
        <username>Sysop</username>
      </user.modified>
      <change-description>initial value</change-description>
    </property>

    Implementation notes 

    Add notes about requirements or config values

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

    Copyright © 2011 MindTouch, Inc. Powered by