grnhse / greenhouse-api-docs

Documentation for Greenhouse Software's APIs
https://developers.greenhouse.io
Apache License 2.0
109 stars 74 forks source link

Issue adding prospect #459

Open HiveFiveKaran opened 2 years ago

HiveFiveKaran commented 2 years ago

Hello, I'm trying to add a prospect, based on the documentation provided here: https://developers.greenhouse.io/harvest.html#post-add-prospect and here: https://developers.greenhouse.io/harvest.html#the-application-object

I am able to add the prospect correctly, but the prospect does not get added the the prospect pool as I would have hoped. I have double checked IDs etc to make sure they're ok, but still can't see any obvious issue.

Below is the structure of the JSON request I'm making, with data redacted for security:

{
  "company": "REDACTED",
  "title": null,
  "tags": [
    "REDACTED"
  ],
  "application": {
    "prospect": true,
    "job_ids": [
      REDACTED
    ],
    "source_id": REDACTED,
    "prospect_pool_id": REDACTED,
    "prospect_pool_stage_id": REDACTED
  },
  "first_name": "REDACTED",
  "last_name": "REDACTED",
  "email_addresses": [
    {
      "value": "REDACTED",
      "type": "personal"
    }
  ],
  "social_media_addresses": [
    {
      "value": "linkedin.com/in/REDACTED"
    }
  ]
}

The API Key I use has access to add prospects - as far as I can tell, that should be all I need.

Is this a documentation problem?

As a side note, it would be VERY useful to list the permissions required by a given endpoint in the documentation directly.

JackieKrkwd commented 2 years ago

We are having the same issue. We are trying to add prospects and include them in specific pools/departments/offices. We started with this endpoint https://developers.greenhouse.io/harvest.html#post-add-prospect and realized it will not accept prospect_pool _id, prospective_department_id, or prospective_office_id as parameters. Now we're using this endpoint https://developers.greenhouse.io/harvest.html#post-add-candidate and getting a 422 Unprocessable Entity error message with the following response:

{
    "errors": [
        {
            "message": "Missing required field: job_id",
            "field": "job_id"
        },
        {
            "message": "A job with this id does not exist.",
            "field": "job_id"
        }
    ]
}

We are passing "prospect": "true" as the documentation states. Here is an example of the payload:

{
  "first_name": "Prospect-Test",
  "last_name": "Prospect-Test",
  "is_private": false,
  "phone_numbers": [
    {
      "value": "5555555555",
      "type": "mobile"
    }
  ],
  "email_addresses": [
    {
      "value": "test@test.com",
      "type": "personal"
    }
  ],
  "website_addresses": [
    {
      "value": "https://test.com",
      "type": "personal"
    }
  ],
  "social_media_addresses": [
    {
      "value": "https://linkedin.com/test"
    }
  ],
  "applications": [
      {
        "prospect": "true",
        "prospect_pool_id": 123456,
        "prospective_office_id": 123456,
        "prospective_department_id": 123456,
        "attachments": [
          {
            "filename": "Test.docx",
            "type": "resume",
            "content": "http://test.local/wp-content/uploads/2022/02/Test-13.docx",
            "content_type": "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
          },
          {
            "filename": "Test.docx",
            "type": "cover_letter",
            "content": "http://test.local/wp-content/uploads/2022/02/Test-14.docx",
            "content_type": "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
          }
        ]
      }
  ]
}

Alternatively, if we create the prospect using https://developers.greenhouse.io/harvest.html#post-add-prospect we are able to update the pool/department/office by using the https://developers.greenhouse.io/harvest.html#post-add-application-to-candidate-prospect however it seems like this should not have to be a 2 step process.