You can programmatically create new entries on a RAMADDA server. There is a Java class, ucar.unidata.repository.RepositoryClient, that provides some of the facilities. You can also look at the ucar.unidata.repository.idv.RamaddaPublisher which is used within the IDV to publish content to RAMADDA. This class uses the ucar.unidata.repository.InteractiveRepositoryClient class that provides some GUI facilities (e.g., a folder JTree component).

Lets say you want to upload a file (e.g., test.png) to RAMADDA. First you need to establish a session with RAMADDA. You can just do a url get with:

https://<server>:<https port>/repository/user/login?output=xml&user.password=<password>&<user>
Or if you don't have https:
The output=xml tells RAMADDA to return the result as xml.

The above request returns xml of the form:

<response code="ok">
Or if there was an error:
<response code="error">
some error message
Subsequent posts to RAMADDA just require an extra argument:
You can also use RepositoryClient code:
  RepositoryClient client = new RepositoryClient(server, 80, "/repository", userId,password);
  String[] msg = { "" };
  if (client.isValidSession(true, msg)) {
       System.err.println("Valid session");
   } else {
        System.err.println("Invalid session:" + msg[0]);
Next, create an entry xml file that defines the entries you want to create.

Now, zip up this xml file along with the file you want to upload and then post the zipped file to:

Include the arguments:
Note: an alternative way to specify the destination parent entry in the repository is to pass the entry id in as a URL argument:
group=some parent entry id 
If you are not uploading files you can just post the xml file instead of the zip file. In that case instead of a file= attribute in the xml use url=, e.g.,:
  <entry name="Some opendap url" 
            url="the opendap url"  
            parent="<some parent entry id>" 
Either way, you will get back the response xml with either code=ok and a list of the entry ids created:
<response code="ok">
  <entry id="1219161636252_0.6145187911490728_17"/>
Or an error response:
<response code="error">
error message
Here is a longer version of an entries file:
  <entry description="" east="-3.950" file="test.xidv" fromdate="2008-08-19 16:01:00 GMT" id="0" name="test.png" north="71.864" parent="<some parent entry id>" south="-7.926" todate="2008-08-19 16:01:00 GMT" type="file" west="-198.358"/>
  <entry east="-3.950" file="test.png" fromdate="2008-08-19 16:01:00 GMT" id="1" name="test.png - Product" north="71.864" parent="<some parent entry id>" south="-7.926" todate="2008-08-19 16:01:00 GMT" type="file" west="-198.358"/>
  <association from="0" name="generated product" to="1"/>
With its response:
<response code="ok">
  <entry id="1219161636252_0.5912686911125428_33"/>
  <entry id="1219161636252_0.34475975368841827_34"/>
  <association id="1219161636252_0.18087075533515407_35"/>

11.2.0 Metadata
You can also create metadata (or properties) in the XML. Inside the entry tag you can have any number of metadata tags. You define the type and the attribute values. Note: This only works for the more simple metadata elements like tag, personnel, etc. The more complex ones with nested structured would require knowing RAMADDA's internal (and rather ill thought out) metadata storage model. A simple metadata xml tag looks like:
<entry ...>
<metadata type="some type" attr1="atribute 1 value" attr2="attribute 2 value" .../>
So to add a "tag" metadata use the xml:
    <metadata inherited="false" type="enum_tag" attr1="TAG VALUE">
If you have values that don't work as XML attributes due to their content or their length you can include them as tags. The encoded="false" says this is unencoded text. The default is encoded=true which implies the text is base64 encoded (see below).
   <metadata inherited="true" type="some type">
      <attr index="1" encoded="false"><![CDATA[value 1]]></attr>
      <attr index="2" encoded="false"><![CDATA[value 2]]></attr>
A simple way to see the metadata xml is to create a folder or other entry in RAMADDA. Add a number of properties to it then do File->Export. Uzip the .zip file and look at the entries.xml Note: the contents of the attr tags are CDATA blocks of base64 encoded text. Base64 encoding of the text is the default and is what is expected when RAMADDA ingests this XML unless you have encoded=false.
   <metadata inherited="true" type="some type">
      <attr index="1"><![CDATA[TlNGLU9QUA==]]></attr>
      <attr index="2"><![CDATA[SW5jcmV=]]></attr>

11.2.0  Metadata