0

We are trying to create multiple similar roles and in order to avoid manual clicking and potential human error we would like to create these roles via API. Based on https://developer.salesforce.com/docs/atlas.en-us.noversion.mc-apis.meta/mc-apis/configure.htm Create, Update and Delete should all work with the Configure Request type, which is noted as the correct one on https://developer.salesforce.com/docs/atlas.en-us.noversion.mc-apis.meta/mc-apis/role.htm (along with retrieve).

When using Delete, this does work, but when changing to update or create (as per snippet) this returns the error

<StatusCode>Error</StatusCode>
<StatusMessage>Create is not a valid Role Configure action.</StatusMessage>
<OrdinalID>0</OrdinalID>
<ErrorCode>332001</ErrorCode>

Sample Request body for Create, but Update returns the exact same thing

<s:Body
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <ConfigureRequestMsg
        xmlns="http://exacttarget.com/wsdl/partnerAPI">
        <Options></Options>
        <Action>Create</Action>
        <Configurations>
            <Configuration xsi:type="Role">
                <CustomerKey>Campaign_Manager</CustomerKey>
                <Name>Campaign Manager</Name>
                <Permissions>
                    <Permission>
                        <PartnerKey xsi:nil="true" />
                        <ID>1</ID>
                        <ObjectID xsi:nil="true" />
                        <Name>WebService API</Name>
                        <Description>WebService API</Description>
                        <ObjectType>API Access</ObjectType>
                        <Operation>Access Web Service API</Operation>
                        <IsShareable>true</IsShareable>
                    </Permission>
                </Permissions>
            </Configuration>
        </Configurations>
    </ConfigureRequestMsg>
</s:Body>

2 Answers 2

1

We have been working on https://www.npmjs.com/package/mcdev and have found a way to get this to work. Came back looking for a new issue and wanted to update that you can do this, but you need to use the ObjectID in the target environment, the Customer Key doesnt work for some reason (fails with the very helpful message "Exception occurred during Update Role").

Below is an example, but only the top level headers

<?xml version="1.0" encoding="UTF-8"?>
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
    <s:Header>
        <a:Action s:mustUnderstand="1">Update</a:Action>
        <a:MessageID>urn:uuid:7e0cca04-57bd-4481-864c-6ea8039d2ea0</a:MessageID>
        <a:To s:mustUnderstand="1">{{soap_instance_url}}Service.asmx</a:To>
        <fueloauth xmlns="http://exacttarget.com">{{access_token}}</fueloauth>
    </s:Header>
    <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
        <UpdateRequest xmlns="http://exacttarget.com/wsdl/partnerAPI">
            <Objects xsi:type="Role">
                <ObjectID>0d77e348-c785-ec11-ba31-f40343e86f50</ObjectID>
                <CustomerKey>Administrator_ReadOnly</CustomerKey>
                <Name>Administrator ReadOnly</Name>
                <Description>Description Changed</Description>
            </Objects>
        </UpdateRequest>
    </s:Body>
</s:Envelope>
0

Salesforce support, after much discussion, advised that roles cannot be created or updated via API

1
  • Hey @Doug, I don't know if you're still looking for this, but I found it is possible to create these. Feb 16, 2021 at 15:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .