I'm trying to use Microsoft Flow and the Send an HTTP request to SharePoint action to deploy an SPFx application customizer to a modern team site.
I'm able to use the /_api/Site/UserCustomActions endpoint to list existing custom actions but keep getting errors when I try to create new using REST
Site address: https://contoso.sharepoint.com/sites/a-modern-team-site
Method: POST
Uri: /_api/Site/UserCustomActions
Headers:
- Accept application/json; odata=verbose
- Content-Type application/json; odata=verbose
Body:
{
'__metadata': { 'type': 'SP.UserCustomAction' },
"Location":"ClientSideExtension.ApplicationCustomizer",
"Rights":"ManageWeb",
"Title":"EnableTeamsApplicationCustomizer",
"Name":"EnableTeamsApplicationCustomizer",
"ClientSideComponentId":"fa80f680-bda9-4c15-a8fe-4e86be0bf593",
"ClientSideComponentProperties":"{\"autoCreate\":\"true\"}"
}
Here's the error I keep getting. I have tried various encoding of the client side properties, omitted it, but no results. I have tried different variations of the http headers, both with odata=verbose and odata=nometadata. I keep getting the same error, but can't find anything explaining the error.
{
"status": 400,
"message": "An unexpected 'PrimitiveValue' node was found when reading from the JSON reader. A 'StartObject' node was expected.\r\nclientRequestId: 43c303e3-4722-4b5e-a5b5-5fbcc686ec50\r\nserviceRequestId: 1b1e6c9e-a0a1-5000-f082-74dd369cc50f",
"source": "https://contoso.sharepoint.com/sites/a-modern-team-site/_api/Site/UserCustomActions",
"errors": [
"-1",
"Microsoft.SharePoint.Client.InvalidClientQueryException"
]
}