I get 503 when trying to GET profile using identifiers | Community
Skip to main content

I get 503 when trying to GET profile using identifiers

  • July 7, 2022
  • 5 replies
  • 0 views

Dennis18

I have a simple function trying to retrieve Profile data, my Zendesk env is all good and all other Zendesk request is working, but I got a 503 error on this Profile GET request. Where could be the issue for causing this? Thanks.

function requestProfileData(client, identifierObject) {
const { profileSource, profileType, identifierType, identifierValue } = identifierObject;
const settings = {
url: `/api/v2/user_profiles?identifier=${profileSource}:${profileType}:${identifierType}:${identifierValue}`,
type: "GET",
};

client.request(settings).then(
profileData => {
console.log('profileData', profileData)
displayProfileData(profileData);
},
errorResponse => {
displayError(errorResponse);
}
);
}

5 replies

Greg29
  • July 7, 2022
Hi Dennis! We usually see a 503 if your account doesn't have access to the Profiles API. To get access to this, you will need to be on a Suite Team plan or above, as we document here. If you're not sure what plan type you have, check with the owner of your instance and they'll be able to let you know! If you are making these calls from an account that does have access to this, let me know and we can dig further into this.

Dennis18
  • Author
  • July 8, 2022

Hi Greg, we are on Elite plan.


Dennis18
  • Author
  • July 8, 2022

I can get Deal data using

client.get("deal.contact")


Only the Profile API returns 503, like the following method trying to create a mocked profile. I'm following this doc. Any configuration do we need to make to enable Profile API?

async function createMockedProfile(client) {
const mockedProfile = {
"profile": {
"identifiers": [
{
"type": "email",
"value": "dennis.xiao@example.com"
},
],
"attributes": {
"clearedToBook": "Yes",
}
}
}

const settings = {
url: '/api/v2/user_profiles?identifier=github:client:email:dennis.xiao@example.com',
type: "PUT",
contentType: 'application/json',
data: JSON.stringify(mockedProfile)
};

client.request(settings).then(
(response) => {
console.log('response', response)
console.log('Mocked profile created');
},
errorResponse => {
console.error('Mocked profile failed to be created');
}
)
}

Dennis18
  • Author
  • July 11, 2022

If we use `cors: true`, I would get a status of `0`. Any pointer is really appreciated. Thanks.

{
    "readyState": 4,
    "responseText": "",
    "status": 0,
    "statusText": "error"
}

 

function requestProfileData(client, identifierObject) {
const { profileSource, profileType, identifierType, identifierValue } = identifierObject;
const settings = {
url: `https://subdomain.zendesk.com/api/v2/user_profiles?identifier=${profileSource}:${profileType}:${identifierType}:${identifierValue}`,
type: "GET",
cors: true,
headers: {
"Authorization": "secret string"
}
};

console.log('settings', settings)

client.request(settings).then(
profileData => {
console.log('profileData', profileData)
displayProfileData(profileData);
},
errorResponse => {
console.log('errorResponse=======', errorResponse)
displayError(errorResponse);
}
);
}

Greg29
  • July 11, 2022
Hi Dennis...the Elite plan is not a Suite plan, which is the reason you don't have access to this functionality. You'll want to have your instance owner reach out to the account team to be able to assist you with this.