Page 1 of 1

How to get all candidates that are added to a tearsheet?

Posted: Tue Jun 01, 2021 6:28 am
by hitesh30
Hello,

Trying to get all candidates added to a tearsheet using the following logice but getting an error 400.

{corpToken}/entity/{entityType}/{id}/{toManyFieldName}s?fields={field-list}

Using the following code in python:

lv_url = f"My_URL/entity/Tearsheet/{Tearsheet_ID}/Candidates?fields=id,firstName"
response = requests.get(lv_url, headers = {"Content-Type": "application/json"})
print(response.json())

Get the following error:

{'errorMessage': 'Unknown or badly structured command: /entity/Tearsheet/4XXX7/Candidates/.', 'errorMessageKey': 'errors.badCommand'}

Pleas help.

Thank You

Re: How to get all candidates that are added to a tearsheet?

Posted: Thu Jun 03, 2021 10:40 am
by juanvargas
Hello,

Can you please clarify the goal, are you looking to mass update a tearsheet to add candidates? Or are you looking to pull the data that is within a tearsheet?

If you are looking to perform a mass update you can use the call below:

URL/massUpdate/Tearsheet?&BhRestToken=***

Body:
{
"ids" : [10451],
"candidates":{"add":[107971,353231,105271]}
}

(tearsheet ID - 10451)

Please let me know if this helps. Thanks!

Re: How to get all candidates that are added to a tearsheet?

Posted: Thu Jun 03, 2021 10:59 am
by hitesh30
Hello,

I am trying to pull all the data that is in a tearsheet. Especially the associated candidates.

For example if there are 50 candidates in a tearsheet I want to get all of them.

Endpoint being used: {corpToken}/entity/{entityType}/{id}/{toManyFieldName}s?fields={field-list}

Using the following code in python:

lv_url = "My_URL/entity/Tearsheet/{Tearsheet_ID}/Candidates?fields=*"
Get the following error:
{'errorMessage': 'Unknown or badly structured command: /entity/Tearsheet/4XXX7/Candidates/.', 'errorMessageKey': 'errors.badCommand'}

Pleas help.

Thank You

Re: How to get all candidates that are added to a tearsheet?

Posted: Fri Jun 04, 2021 1:08 pm
by juanvargas
Hello,

Thank you for clarifying.

To accomplish this please use the call provided below:

URL/entity/Tearsheet/(tearsheetID)?fields=candidates(id)&BhRestToken=*

This should provide you with all the associated candidates along with their First and Last name.

Please let me know if this resolves your issue. Thank you!

Re: How to get all candidates that are added to a tearsheet?

Posted: Mon Jun 07, 2021 4:54 am
by hitesh30
Hello,

Thank You for helping out this method always return a maximum of 5 candidates that were added to a tearsheet (and despite of paging using start and count values return always same 5 candidates)

I have used changed URL as follows:

URL/entity/Tearsheet/(tearsheetID)?fields=candidates(id)&start=0&count=5&BhRestToken=*

URL/entity/Tearsheet/(tearsheetID)?fields=candidates(id)&start=5&count=5&BhRestToken=*

URL/entity/Tearsheet/(tearsheetID)?fields=candidates(id)&start=10&count=5&BhRestToken=*

But I always get a set of same 5 candidates although there are 15 candidates in a tearsheet. Please help to resolve this issue.

Thank You