Adding a candidate via API with attachement

37 views
Skip to first unread message

Sam De Decker

unread,
Mar 20, 2024, 11:31:05 PMMar 20
to CATS API v3
Hi, 

We are trying to add a API call to add Candidates to a job, that works. 
But now the client wants to make sure we also send over the resume. 

We can use https://docs.catsone.com/api/v3/#candidates-upload-a-resume but this call requires an "The ID of the candidate that the resume is being attached to." which we don't know since the application just happend. 

Any suggestions on what is the best workflow here?  

Steve Gagnon

unread,
Apr 26, 2024, 3:34:09 PMApr 26
to CATS API v3
Most of the records that create records return a response header named "location" with the URL to the record that was created. For example when creating a candidate:

$ curl -X POST \
> https://api.catsone.com/v3/candidates?check_duplicate=true \
> -H 'authorization: Token ???????'' \
> -H 'content-type: application/json' \
> -d '{"first_name":"Kole","last_name":"Howe","emails":[{"is_primary":true,"email":"te...@example.com"}]}' \
> -v
Note: Unnecessary use of -X or --request, POST is already inferred.
*   Trying 52.86.13.191:443...
* TCP_NODELAY set
* Connected to api.catsone.com (52.86.13.191) port 443 (#0)
.....
< HTTP/2 201
< date: Fri, 26 Apr 2024 19:31:17 GMT
< content-type: text/html; charset=UTF-8
< location: https://api.catsone.com/v3/candidates/403667268
< x-rate-limit-limit: 500
< x-rate-limit-remaining: 494
< x-request-id: feef0ac3-3161-4aff-9267-05e0745dffad


The candidate's ID will be the part of the url following the last "/" character. Things do change a bit if you set check_duplicate=true and there is a duplicate:

> https://api.catsone.com/v3/candidates?check_duplicate=true \
> -H 'authorization: Token ???????' \
> -H 'content-type: application/json' \
> -d '{"first_name":"Kole","last_name":"Howe","emails":[{"is_primary":true,"email":"te...@example.com"}]}' \
> -v
Note: Unnecessary use of -X or --request, POST is already inferred.
*   Trying 34.226.128.103:443...
* TCP_NODELAY set
* Connected to api.catsone.com (34.226.128.103) port 443 (#0)
....
< HTTP/2 409
< date: Fri, 26 Apr 2024 19:31:20 GMT
< content-type: application/json; charset=utf-8
< x-rate-limit-limit: 500
< x-rate-limit-remaining: 493
< x-request-id: b059b6c9-bf33-4afc-8241-1ba224d86590
<
* Connection #0 to host api.catsone.com left intact
{"message":"Duplicate found.","data_item":{"type":"candidate","id":403667268}}

Now you get JSON response with the candidate_id.
Reply all
Reply to author
Forward
0 new messages