Skip to content

Attachments V2


Description

The attachments endpoint is used to view attachments for the 3 primary record types in PCRecruiter, Candidates, Companies and Positions. This endpoint can be used to view a list of attachments for a specific record and retrieve the attachment id of a specific attachment. When querying the attachments endpoint, you will want to ensure to include the record type for attachments you are searching for. The available record types are Candidates, Companies and Positions. Ex: /Candidates/attachments

Once the id of an attachment has been retrieved, another call to the attachments endpoint can be made to retrieve the data within the attachment. All attachments in the response will be a base64 encoded URL where the attachment can be viewed.

Available query parameters

  • AttachmentId
  • JobId
  • CandidateId
  • CompanyId
  • Name
  • Type
  • Description
  • Size
  • Date
  • Data

Data parameters

  • AttachmentId - This is the unique id for the attachment returned
  • JobId - This is the unique id for the position when retrieving position attachments
  • CandidateId - This is the unique id for the candidate when retrieving candidate attachments
  • CompanyId - This is the unique id for the company when retrieving company attachments
  • Name - This is the name for the attachment. This is commonly the exact file name
  • Type - This is the type of attachment. Current options include HTML, Profile, Upload and CAPROFILE2
  • Description - The description of the attachment. This can often mirror the name parameter
  • Size - This parameter represents the size of the attachment in bytes
  • Date - The data parameter represents the date the attachment was added or last modified
  • Data - Data will be the actual attachment data. This will be base64 encoded

Examples

------------------ REQUEST -------------------
api
GET /rest/api/globalV2/attachments/
Authorization: BEARER {SessionId}
json
{
  "method": "GET",
  "url": "https://www2.pcrecruiter.net/rest/api/globalV2/attachments/{record id}",
  "headers": {
    "Content-Type": "application/json"
    "Authorization": "BEARER Token"
  },
  "path"{
    "record id": record id,
  }
}
------------------ RESPONSE ------------------
json
{  
"TotalRecords": 1,  
"Results":\[  
{  
"AttachmentId": {attachment Id},  
"Name": "File\_name",  
"Type": "Resume",  
"Description": "Attachment Description",  
"Size": 456263,  
"Date": "2018-12-05T16:54:10"  
}  
\]  
}

TIP

This API call is used to retrieve a full list of the attachments for the record id specified in the query. The response includes the AttachmentId which can be used to retrieve the base64 URL for an exact attachment. The record id will be the CandidateId, CompanyId or JobId based on which record type you are looking for. You can view the resources for Candidates, Companies and Positions to view more on how to retrieve the record id for a specific record.

------------------ REQUEST -------------------
API
GET /rest/api/Candidates/{record id}/attachments/{attachment id}  
Authorization: BEARER {SessionId}
json
{
 "method": "GET",
 "url": "https://www2.pcrecruiter.net/rest/api/Candidates/{record id}/attachments/{attachment id}",
 "headers": {
   "Content-Type": "application/json",
   "Authorization": "BEARER Token"
 },
 "path":{
   "record id": record id,
   "attachment id": attachment id
 }
}
------------------ RESPONSE ------------------
json
{  
"AttachmentId": {attachment id},  
"Name": "{attachment name}",  
"Type": "Resume",  
"Description": "Attachment Description",  
"Size": 456263,  
"Date": "2018-12-05T16:54:10",  
"Data": "aHR0cHM6Ly93d3cucGNyZWNydWl0ZXIubmV0L2FwaWRvY3NfdjIv  
IyEvYXR0YWNobWVudHMvR2V0QXR0YWNobWVudF9nZXRfMA=="  
}

TIP

This API call is similar to the first with the addition of the attachment id appended to the end of the request. This tells PCRecruiter to retrieve data for only that specific attachment. Included in the response is the data parameter which will be the base64 URL of the attachment which can be viewed once decoded.

------------------ REQUEST -------------------
API
GET /rest/api/Candidates/attachments/  
Authorization: BEARER {SessionId}
json
{
  "method": "GET",
  "url": "https://www2.pcrecruiter.net/rest/api/Candidates/attachments",
  "headers": {
    "Content-Type": "application/json",
    "Authorization": "BEARER Token"
  },
}
------------------ RESPONSE ------------------
json
{  
"TotalRecords": 2,  
"Results":\[  
{  
"AttachmentId": {attachment id},  
"Name": "{attachment name}",  
"Type": "HTML",  
"Description": "Attachment Description",  
"Size": 3261,  
"Date": "2018-08-28T15:14:36"  
},  
{  
"AttachmentId": {attachment id},  
"Name": File\_name,  
"Type": "Profile",  
"Description": "Attachment Description",  
"Size": 19850,  
"Date": "2018-10-12T15:44:52"  
}  
\]  
}

TIP

This call to attachments does not specify a record id but does specify a record type. This will return all attachments for that record type. This does not return a record id in the response, so it is suggested to retrieve the record id from the corresponding record type endpoint if this information is needed.

------------------ REQUEST -------------------
API
POST /rest/api/Candidates/{record id}/attachments  
Authorization: BEARER {SessionId}  
  
{  
"Name": "{attachment name}",  
"Type": "Upload",  
"Description": "{attachment description}",  
"Date": "",  
"Data": "UENSZWNydWl0ZXIKTWFpbiBTZXF1ZW5jZSBUZWNobm9sb2d5C  
jQ0MjAgU2hlcndpbiBSb2FkCldpbGxvdWdoYnksIE9  
oaW8gNDQwOTQKKDQ0MCkgOTQ2LTUyMTQ="  
}
json
{
  "method": "POST",
  "url": "https://www2.pcrecruiter.net/rest/api/Candidates/{record id}/attachments",
  "headers": {
    "Content-Type": "application/json",
    "Authorization": "BEARER Token"
  },
    "body": {
    "Name": "attachment name",  
    "Type": "Upload",  
    "Description": "attachment description",  
    "Date": "",  
    "Data": "BASE64 encoded string" 
  },
  "path" {
    "record id": "record id"
  },
}
------------------ RESPONSE ------------------
json
{  
"AttachmentId": "{attachment id}"  
}

TIP

This call creates a new attachment for the record id listed in the API call URL. You can similarly use a PUT call to update an attachment using the same parameters and adding the attachment id to the end of the URL. It should be noted that the data should be base64 encoded in the data parameter. When retrieving an attachment that was added via POST, the base64 result will be the attachment instead of a URL that can be used to view the attachment.