2

In Summer '19, we got access to a new POST method on the connect/communities endpoint, allowing for programmatic creation of a Community:

Make a POST request to the existing /connect/communities resource with the new Community Input request body.

The resource is documented here and takes a JSON body:

{
   "name":"The Capricorn Cafe",
   "urlPathPrefix":"capricorncafe",
   "templateName":"Customer Service",
   "description":"Coffee and coffee products for the most discerning tastes."
}

I would like to use this endpoint to create a Salesforce Tabs + Visualforce community. However, making this call with "templateName": "Salesforce Tabs + Visualforce" yields

{'errorCode': 'INVALID_INPUT', 'message': 'The specified community template does not exist.'}]

If you make a request to the Community Templates endpoint, it does indeed include an entry called "Salesforce Tabs + Visualforce". However, using a GET to connect/communities to obtain information on existing Communities, Visualforce communities shows

    "templateName" : null,

None of the following options work:

  • Percent-encoding the name.
  • Omitting the templateName entirely.
  • Passing null
  • Passing the literal string "null"
  • Passing an empty string

All yield the same error.

Is this possible? What input is the endpoint looking for?

2

I don't think this is documented, but I figured it out by looking at the outbound requests from the Communities wizard in Chrome Inspector.

The template name that the Connect API accepts for Salesforce Tabs + Visualforce is "VF Template". The Community creation process can be invoked by doing

POST /services/data/v46.0/connect/communities
{
    "name": "My Community",
    "description": "",
    "templateName": "VF Template",
    "urlPathPrefix": "my_community"
}
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.