Expand my Community achievements bar.

SOLVED

API | Get profile by phone number

Avatar

Level 2

Hey.

I am currently working on an integration using the ACS API. I have managed to figure out how to fetch profiles using the endpoint "/byEmail?email=" but now I also want to be able to use a phone number in case there is no email present. I simply tried using byPhone and byMobilePhone but to no avail. Is it possible to get profiles by phone number, and if so what would the request URL be?

Best regards,

Richard Byström.

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

There is no default filter for phone / mobile phone.

What you can do:

  • Create a custom resource extending the profile resource
  • Add a related filter definition with a paramter to search on phone and/or mobile phone
  • This will add a new endpoint to the API which you can use to filter on phone / mobile phone

View solution in original post

10 Replies

Avatar

Correct answer by
Employee Advisor

There is no default filter for phone / mobile phone.

What you can do:

  • Create a custom resource extending the profile resource
  • Add a related filter definition with a paramter to search on phone and/or mobile phone
  • This will add a new endpoint to the API which you can use to filter on phone / mobile phone

Avatar

Level 2

Thanks for your response! Are there any resources on how to configure the filter definition for it to take the value from the request URL?

I've been looking at these:

Configuring filter definition
Step 2: Publish the extension

Adobe Campaign Standard API

However I was unable to find details on how to configure the filter definitions. Do you know if there are any further guides or resources?

Best regards,

Richard Byström

Avatar

Level 2
I'm trying to GET users based on their cusUserID. Any idea how to do this in the API? Also is there a dictionary or more detailed version of the API documentation, there appears to be a ton of stuff missing which I've had to work out via trial and error, not ideal.

Avatar

Level 2
@adobe team - Have you any thoughts on this? Just building a new solution and keen to understand if this is do able.

Avatar

Employee Advisor

If you follow the first link, you should see the info about using parameters.

Once created, you can click on "Metadate" link for the custom resource.

This has a reference to list all filters and there you should see the information on how the parameter is used

Avatar

Level 2

Hey. Sorry for the late reply but I've been struggling to figure out why I'm not getting it to work.

I have managed to create a filter definition and looking in metadata as advised to find the link to the filter definitions API. From there, I requested the JSON with all filter definitions. The resulting JSON in a readable format is a little too large to post here, so I'll put it in it's compact format and you can verify the contents in jsoneditoronline.org or similar:

{"byPhone":{"PKey":"x","category":"0150_profile","condition":{"condition":[{"PKey":"x","boolOperator":"AND","condition":[],"dateTypeAndPrecision":{"operator":"","precision":"","type":""},"desc":"","enabledIf":"","entityLabel":"","entityName":"","entityType":"","expr":"@mobilePhone = $(__FILTER_CTX__/@phone_parameter)","filterLabel":"","filterName":"","internalId":1726021991,"order":1,"setOperator":"","subQuery":{"conditionLink":{},"ctx":"","groupBy":{"node":[]},"having":{"condition":[]},"operation":"","orderBy":{"node":[]},"schema":"","select":{"node":[]},"where":{"condition":[],"ctx":"","displayFilter":"","filterName":""}},"xpath":""}],"ctx":"","displayFilter":"","filterName":"byPhone"},"data":"/rest/profileAndServicesExt/profile/byPhone?phone_parameter=$value","formType":"externalFragment","fragmentName":"component:cusFilterFormProfilePhone","label":"Phone","metadata":{"PKey":"","content":{"cusFilterProfilePhone":{"PKey":"x","apiName":"cusFilterProfilePhone","category":"","content":{"phone_parameter":{"PKey":"x","apiName":"phone_parameter","category":"","dataPolicy":"","desc":"","displayFormat":"","help":"","label":"Phone","lazyLoaded":false,"length":"","mandatory":false,"metadata":"attribute","privacy":"firstParty","queryable":true,"readOnly":false,"resName":"","resType":"uuid","sortable":true,"type":"string"}},"dataPolicy":"","desc":"","displayFormat":"","help":"","label":"","lazyLoaded":false,"length":"","mandatory":false,"metadata":"element","privacy":"firstParty","queryable":true,"readOnly":false,"resName":"","resType":"","sortable":true,"type":"item","unbound":false}},"label":"","mandatory":false,"name":"cusFilterProfilePhone","pkgStatus":"","readOnly":false,"type":"item"},"resName":"byPhone","webPage":"","webPageName":""}}

Now I don't know what this is *supposed* to look like, but comparing to the native byEmail API I don't see any particular differences that would seem to affect the function. In any case, when running a get request to this API I simply get 25 results not related to the parameter included in the request. So obviously I did *something* wrong, but I haven't been able to find it myself. Do you have any idea what it might be?

Best regards,

Richard Byström.

Avatar

Employee Advisor

The byPhone extract looks ok.

I just did a test on my side with a custom filter and the extract is looking similar here and REST call is returning the filtered data.

So are you doing a GET request to following URL?

https://mc.adobe.io/{{tenant}}/campaign/profileAndServicesExt/profile/byPhone?phone_parameter=012345

Avatar

Employee Advisor

The URL in the space is only here in the forum or do you have that as part of the actual call?

Normally you should not have a space there.

Avatar

Level 2

I went and doublechecked the logs and ran it again - the space is not there in the request. I must have accidentally put it there when copy pasting.