Creating a custom site using the REST API

(imported topic written by ewiborg)

I’m trying to create a custom site using the API. Here is the XML I post to /api/sites:

<BES xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="BES.xsd">
<CustomSite>
            <Name>ACME</Name>
            <Description></Description>
            <Domain>BESC</Domain>
            <GlobalReadPermission>false</GlobalReadPermission>
            <Subscription>
        <Mode>Custom</Mode>
        <CustomGroup>
          <SearchComponentPropertyReference PropertyName="Customer" Comparison="Equals">
            <SearchText>ACME</SearchText>
            <Relevance>exists (value of setting "Customer" of client) whose (it as string as lowercase = "ACME" as lowercase)</Relevance>
          </SearchComponentPropertyReference>
        </CustomGroup>
            </Subscription>
    </CustomSite>
</BES>

which is exactly the API-returned XML of a manually created site with the subscription criteria I want. The property “Customer” exists.

After posting, the site is created but has the message

This group contains references to groups and/or retrieved properties that did not exist at the time the group was last modified, but do exist now. The following references are not currently included in the group definition, but can be automatically resolved. To automatically resolve the references, please edit this group.

and the “Save changes” button is active. Clicking that button makes the site behave as expected.

What am I doing wrong? Is there a way to perform the same action as the “Save changes” button via the API?

I would guess that you’re not doing anything wrong. The REST API has some rough edges. This may be a defect.

I don’t believe that there is a way to perform the same action as the “Save changes” button via the API. However, that shouldn’t be necessary. Have you tried different properties, or other slight modifications to the CustomSite BES XML? Sometimes the XML can be massaged to get what you want. Sometimes.

This functionality is definitely broken and I’ve opened a bug internally to get it fixed. There is no other valid way to specify property-based subscription per the XSD, and creating the site (or updating the subscription later) this way actually creates an invalid subscription action for the site, which is why the console message appears. For now, you’ll have to create these sites manually, or click on Save Changes in the console after the site is created.

Hi Steve,If we have powershell script in which with IEM CLI if we have custom site create functionality and have the explicit transaction commit for the IEM database does this will help for save changes button.

Is there any API available or fix available in 9.2 and onward IEM versions? or still the issue persists.

Thanks.

This issue was reported over 2 years ago, so I expect it would be fixed in current 9.2 and 9.5 versions. Are you actually seeing this problem?

Thanks.Yes confirmed with later versions 9.2.9 and 9.5 - no more issue.
While was looking for support if any of the client has older setup 9.1 or 9.2.5 if can be provided with patch.