Add a Model Structure

You can add a new component by providing its model structure using the POST method on the modelstructure-for-component endpoint. You need a token with write privileges, otherwise a 401 or 403 will be sent back.

Component metadata

The model structure is accompanied with component metadata, which is made of the three fields that identify a component: an archive, a section and a hypercube report element.

POST http://host.28.io/v1/_queries/public/api/modelstructure-for-component?token=c3049752-4d35-43da-82a2-f89f1b06f7a4
{
    "Archive" : "my-archive",
    "SectionURI" : "http://www.example.com/my-section",
    "HypercubeName" : "my:Hypercube"
    "ModelStructure" [ ... ]
}

Model Structure

The model structure itself is a tree of report elements. It must fulfill the following constraints:

Here is an example of model structure for a component associated with a hypercube report element that is not the implied table:

POST http://host.28.io/v1/_queries/public/api/modelstructure-for-component?token=c3049752-4d35-43da-82a2-f89f1b06f7a4
{
    "Archive" : "my-archive",
    "SectionURI" : "http://www.example.com/my-section",
    "HypercubeName" : "my:Hypercube"
    "ModelStructure": [
      {
        "Name": "foo:Abstract1",
        "Children": [
          {
            "Name": "foo:Hypercube1",
            "Children": [
              {
                "Name": "foo:Dimension1",
                "Children": [
                  {
                    "Name": "foo:Member1"
                  }
                ]
              },
              {
                "Name": "foo:LineItems",
                "Children": [
                  {
                    "Name": "foo:Abstract2",
                    "Children": [
                      {
                        "Name": "foo:Concept1"
                      },
                      {
                        "Name": "foo:Concept2"
                      },
                      {
                        "Name": "foo:Concept3"
                      }
                    ]
                  }
                ]
              }
            ]
          }
        ]
}

And here is an example of model structure for a component that is the implied table of a section. It has no hypercube report element and no dimensional structure, only abstract and concept report elements.

POST http://host.28.io/v1/_queries/public/api/modelstructure-for-component?token=c3049752-4d35-43da-82a2-f89f1b06f7a4
{
    "Archive" : "my-archive",
    "SectionURI" : "http://www.example.com/my-section",
    "HypercubeName" : "xbrl28:ImpliedTable"
    "ModelStructure": [
      {
        "Name": "foo:Abstract1",
        "Children": [
          {
            "Name": "foo:Abstract2",
            "Children": [
              {
                "Name": "foo:Concept1"
              },
              {
                "Name": "foo:Concept2"
              },
              {
                "Name": "foo:Concept3"
              }
            ]
          }
        ]
      }
    ]
}

In general, any object output by a GET on the modelstructure-for-component endpoint will be accepted in a POST, so that you can take a model structure from an archive with a GET and feed them into another archive with a POST.

You can post several component's model structures at a time by sending them concatenated, with no comma separator.

In case of success, an empty response body is issued with a 204 status.

Common HTTP errors

Further reference

The reference for the REST API including the JSound schema for the input is documented here