Unless I'm missing something, I don't see any way to set a PIPELINE_ID or STAGE_ID for an opportunity. As specified in the API docs, these fields cannot be set in the usual way, and a special API exists to set them:
https://api.insight.ly/v2.2/Help#!/Opportunities/UpdatePipeline
For now, I am formulating an HTTP PUT with Python requests, which is a workaround (code below) but would be great to get this into the API.
from base64 import b64encode
import requests
def update_pipeline(apikey, entity_type, object_id, pipeline_id, stage_id):
"""Updates pipeline. Inexplicably this is not in the API."""
payload = {
"PIPELINE_ID": pipeline_id,
"PIPELINE_STAGE_CHANGE": {"STAGE_ID": stage_id}
}
headers = {
'Content-Type': 'application/json',
'Authorization': 'Basic {0}'.format(b64encode(apikey))
}
uri = 'https://api.insight.ly/v2.2/{0}/{1}/Pipeline'.format(entity_type, object_id)
response = requests.put(uri, headers=headers, json=payload)
response.raise_for_status()
return response.json()
Unless I'm missing something, I don't see any way to set a PIPELINE_ID or STAGE_ID for an opportunity. As specified in the API docs, these fields cannot be set in the usual way, and a special API exists to set them:
https://api.insight.ly/v2.2/Help#!/Opportunities/UpdatePipeline
For now, I am formulating an HTTP PUT with Python requests, which is a workaround (code below) but would be great to get this into the API.