Hi,
Recently I'm trying to create a new schema using the API at this endpoint /api/v2/externalcontacts/organizations/schemas, but I'm getting a 403 (missing.any.permissions).
Checking the permissions, I already have all the permissions for external contacts activated and I still can't connect. I didn't find any permission with the description [externalContacts:customFields:add]. I would like some help to create this schema.
My code:
def create_instance():
CLIENT_ID= ""
CLIENT_SECRET= ""
region = PureCloudPlatformClientV2.PureCloudRegionHosts.sa_east_1
PureCloudPlatformClientV2.configuration.host = region.get_api_host()
api_client = PureCloudPlatformClientV2.api_client.ApiClient().get_client_credentials_token(CLIENT_ID, CLIENT_SECRET)
authApi = PureCloudPlatformClientV2.AuthorizationApi(api_client)
api_instance = PureCloudPlatformClientV2.ExternalContactsApi(api_client)
return api_instance
def request(instance):
body = PureCloudPlatformClientV2.DataSchema()
# body.id = "vipSchema"
body.name = "Vip"
body.version = 1
body.enabled = True
body.json_schema = {"id": "vipSchema",
"$schema":"http://json-schema.org/draft-07/schema#",
"title": "Vip",
"description": "Vip schema to companys",
"type": "object",
"required":["status"],
"properties":{"status": {"type": "boolean", "description": "schema True or False"}},
"additionalProperties": False}
response = instance.post_externalcontacts_organizations_schemas(body)
return response
def main():
instance = create_instance()
response = request(instance)
Response:
PureCloudPlatformClientV2.rest.ApiException: (403)
Reason: Forbidden
HTTP response headers: HTTPHeaderDict({'Content-Type': 'application/json', 'Content-Length': '277', 'Connection': 'keep-alive', 'Date': 'Tue, 01 Oct 2024 13:19:16 GMT', 'ININ-Correlation-Id': '59477a56-3928-4b6c-9ad5-cafa9be8911a', 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains', 'Cache-Control': 'no-cache, no-store, must-revalidate', 'X-Cache': 'Error from cloudfront', 'Via': '1.1 11715c60f8f24aceeeb0e30b38755788.cloudfront.net (CloudFront)', 'X-Amz-Cf-Pop': 'GIG51-P1', 'X-Amz-Cf-Id': 'AxrUz_H-ibXXWooDhnzp_MJhVkINVIgU88lt-ikAyPVFtC9LICOQgA=='})
HTTP response body: {"message":"Unable to perform the requested action. You must have at least one of the following permissions assigned: [externalContacts:customFields:add]","code":"missing.any.permissions","status":403,"contextId":"59477a56-3928-4b6c-9ad5-cafa9be8911a","details":[],"errors":[]}