Home

MS Base

  • prefix: ms:
  • schema: b:

Categories (Data):

Categories (Governance):

payloads:

 
 

Payload examples

On this page, a few possibilities to maintain bytes. The specification may be quite hard to grasp without extensive example.

Unit contains all information to find an image

In the example below, the b:unit describes an image which is part of a tar-archive which is gzip-compressed. This is a common format in the UNIX/Linux environment.

<unit>
  <type>iana:MediaType/image/jpeg</type>
  <name>logo.jpg</name>
  <content>
    <size>12121</size>
    <packaged by="wp:Pack/Tar">
      <size>314156</size>
      <compressed by="wp:Compress/Gzip">
        <size>51234</size>
        <fetch href="https://e.com/style.tar.gz" />
      </compressed>
      <entry>logo-50x124.jpg</entry>
    </packaged>
    <checksum by="wp:Checksum/SHA1">
      <encoded by="wpms:Encode/Base64">
        <blob>SGVsbG8sIFdvcmxkIQo=</blob>
      </encoded>
    </checksum>
  </content>
</unit>
"unit" : {
  "type" : "iana:MediaType/image/jpeg",
  "name" : "logo.jpg",
  "content" : {
    "size" : "12121",
    "packaged" : {
      "by" : "wp:Pack/Tar",
      "size" : "314156",
      "compressed" : {
        "by" : "wp:Compress/Gzip",
        "size" : "51234",
        "fetch" : {
          "href" : "https://e.com/style.tar.gz"
        }
      },
      "entry" : "logo-50x124.jpg"
    },
    "checksum" : {
      "by" : "wp:Checksum/SHA1",
      "encoded" : {
        "by" : "wp:Encode/Base64",
        "blob" : "SGVsbG8sIFdvcmxkIQo="
      }
    }
  }
}

Probably, the SHA1 checksum type includes Base64 encoding, so it should not be specified explicitly. However, it is included in the example to demonstrate how it could work.

Unit refers to another unit to find an image

Getting to the data which is distributed via a unit is potentionally recursive. In the example below, the details about where to get the tar-archive is contained in an other unit. Of course, that source can be shared easily by units which describe the separate data elements in that tar.

<unit uid="default-logo.jpg">
  <name>logo.jpg</name>
  <content>
    <mediatype>iana:MediaType/image/jpeg</type>
    <size>12121</size>
    <packaged by="wp:Pack/Tar">
      <source unitref="dist:style.tar" />
      <entry>logo-50x124.jpg</entry>
    </packaged>
    <checksum by="wp:Checksum/SHA1">
      <blob encoded="wp:Encode/Base64">SGV...kIQo=</blob>
    </checksum>
  </content>
</unit>

<!-- in the Namespace with prefix "dist" -->
<unit uid="style.tar">
  <content>
    <mediatype>iana:MediaType/application/tar</type>
    <size>314156</size>
    <compressed by="wp:Compress/Gzip">
      <size>51234</size>
      <fetch href="https://e.com/style.tar.gz" />
    </compressed>
  </content>
</unit>
"unit" : {
  "uid" : "default-logo.jpg",
  "name" : "logo.jpg",
  "content" : {
    "mediatype" : "iana:MediaType/image/jpeg",
    "size" : "12121",
    "packaged" : {
      "by" : "wp:Pack/Tar",
      "source" : { "unitref" : "dist:style.tar" },
      "entry" : "logo-50x124.jpg"
    },
    "checksum" : {
      "by" : "wp:Checksum/SHA1",
      "blob" : {
         "encoded" : "wp:Encode/Base64",
         "_" : "SGV...kIQo="
      }
    }
  }
},

"unit" : {
  "uid" : "style.tar",
  "content" : {
    "mediatype" : "iana:MediaType/application/tar",
    "size" : "314156",
    "compressed" : {
      "by" : "wp:Compress/Gzip",
      "size" : "51234",
      "fetch" : { "href" : "https://e.com/style.tar.gz" }
    }
  }
}

The second unit "style.tar" is in namespace "dist".

Packing units with Native payload.

Although the Native payloads can be specified directly, there may be cases where you want to transport that content like other other data. For instance, when you want to be able to check the signature of them, or when they grow that large that compression is useful. This is possible as well, as the example below shows:

<unit id="config">
  <type>ms:Type/Collection</type>
  <content>
    <blob compressed="wp:Compress/Gzip" encoded="wp:Encode/Base64">
        ...
    </blob>
    <checksum>
       ...
    </checksum>
  </content>
</unit>

mark@overmeer.net      Web-pages generated on 2023-12-19