简体   繁体   中英

how to create a custom profile in salesforce using rest api

Am experimenting with salesforce apis by creating and patching with its api services.I dont know how to create a custom profile with the help of its apis and also i dont know what are all the required body parameters to create a profile. i tried sending a post request with the following body

{
"Name" : "testprofile"
}

to the url /services/data/v54.0/sobjects/Profile i got this message as response

{
        "message": "insufficient access rights on cross-reference id",
        "errorCode": "INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY",
        "fields": []
    }

i reffered https://developer.salesforce.com/docs/atlas.en-us.234.0.object_reference.meta/object_reference/sforce_api_objects_profile.htm

havent got any eloborate writings on what should be in the body while using post request.. but it says create() methods are allowed

It seems that i have to add user license with the body along with the name for the post to scceeded once added it should look like this

{
 "Name":"profilename",
 "UserLicenseId": "license id"
}

and thus made the request work

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM