Add a Report Element

You can add a new report element using the POST method on the report-elements endpoint. You need a token with write privileges, otherwise a 401 or 403 will be sent back.

Report element format

The only mandatory information for a new report element is the AID, Section URI and Name.

POST http://host.28.io/v1/_queries/public/api/report-elements?token=c3049752-4d35-43da-82a2-f89f1b06f7a4
{
    "Archive" : "my-archive",
    "SectionURI" : "http://www.example.com/my-section",
    "Name" : "my:Member"
}

The above request, however, will only work if a report element with this name exists in a different section, in the same archive. All its metadata will then be taken over as it is and added to the new section.

If you still choose to specify more information (such as in the next subsection), it will only be accepted if this information exactly matches that of the report element that already exists in the archive with the same name.

Add a report element new to the archive

If the report element is new to the archive, i.e., exists in no other section, you must provide more information.

In all cases, you must state its kind, one of:

POST http://host.28.io/v1/_queries/public/api/report-elements?token=c3049752-4d35-43da-82a2-f89f1b06f7a4
{
    "Archive" : "my-archive",
    "SectionURI" : "http://www.example.com/my-section",
    "Name" : "my:NewMember",
    "Kind" : "Member"
}

Furthermore, if its kind is Concept, you must supply a period type and a data type.

POST http://host.28.io/v1/_queries/public/api/report-elements?token=c3049752-4d35-43da-82a2-f89f1b06f7a4
{
    "Archive" : "my-archive",
    "SectionURI" : "http://www.example.com/my-section",
    "Name" : "my:NewConcept",
    "Kind" : "Concept",
    "PeriodType" : "duration",
    "DataType" : "xbrli:integerItemType"
}

Optionally, you can specify a value for IsNillable.

You may also specify a Balance if the type is monetary (one of xbrli:monetaryItemType, num:noDecimalsMonetaryItemType, num:nonNegativeMonetaryItemType, num:nonNegativeNoDecimalsMonetaryItemType).

POST http://host.28.io/v1/_queries/public/api/report-elements?token=c3049752-4d35-43da-82a2-f89f1b06f7a4
{
    "Archive" : "my-archive",
    "SectionURI" : "http://www.example.com/my-section",
    "Name" : "my:Assets",
    "Kind" : "Concept",
    "PeriodType" : "instant",
    "DataType" : "xbrli:monetaryItemType",
    "Balance" : "debit"
}

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

You can post several report elements at a time by sending them concatenated, with no comma separator.

In case of success, the response body contains a copy of the report element objects as they have been stored, after post-processing.

Further reference

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