REST API -> Assigning an Affiliate while Creating an Opportunity

I’m creating an opportunity using the Rest API. While creating it, I need to assign it to an existing Affiliate (Referral Partner).

Thiis is my json content:

{
  "contact": {
    "id": "90"
  },
  "custom_fields": [
    {
      "content": "Affiliate",
      "id": 2
    }
  ],
  "stage": {
    "id": "18"
  },
  "opportunity_title": "Test Opportunity"
}

The opportunity is created but not assigned to an affiliate

Any suggestions?

Thanks

Hi @Philip_Holan,

There are two parts to each custom field on a resource. First, there’s the id of the custom field and, second, there’s the content (value) of the field.

{
  "custom_fields": [
    {
      "id": <custom field id>,
      "content": <custom field content>
    }
  ]
}

Let’s say I have a Yes/No custom field on my Opportunities. And, we’ll say it’s there to indicate whether or not the color blue is preferred. The name of the field doesn’t matter in our example, so we’ll omit – but we do care about the id, which turns out to be 5. We would represent this within an Opportunity like this:

{
    "custom_fields": [
        {
            "id": 5,
            "content": "Yes"
        }
    ]
}

Let me know if this helps?

Thanks Mike,

I can see how I will use your response in my next feature. For assigning an affiliate to a contact or to an opportunity, am I looking in the wrong place? Is the affiliate a custom field if I’m subscribed to that module?

No sure how to specify the affiliate using json

Thanks again

Hmm… I’m more familiar with the API than how the Affiliate and Referral Partner features work. I think you might be looking for a little more non-API help; I’ll suggest a couple things that I hope will help you get where you’re going sooner:

  1. Have a look at An Introduction To Referral Partner Management With Infusionsoft in HelpCenter.
  2. Try posting in the general Q&A forum.
  3. Connect with support and ask for help with Affiliate/Referral.

With that squared away, we’ll be ready to help you with using the API!

1 Like

Hi Mike,

I’ve had a similar issue in the past. Can the AffiliateId be specified in the JSON when the opportunity is created when leveraging REST?

The goal would be to set this opportunity level field:

1 Like

I have 2 separate corporate accounts with Infusionsoft.
This is needed feature on both accounts, as Mark Price stated

In addition to this, we also need to populate the ‘Referral Info’ tab when creating a new customer. In particular, ‘Referring Email’ and ‘Referring Name’.

We are willing to pay to get this implement although we know this will benefit your entire community.

Curious to hear if it’s possible in REST from someone at Infusion.

If it’s a big problem, you could potentially do these functions in the (legacy as they call it) SOAP API.

To set AffiliateId on the Opp:
DataService.Add or DataService.Update the Lead table setting the AffiliateId:

To create an Affiliate Referral for a newly entered contact:
run DataService.Add on the Referral table and use the contactId for the newly created contact.

@Mark_Price @Philip_Holan Thanks for letting us know what you’re trying to accomplish through the REST API. It’s super helpful. I’ll pass these requests along to PM to get them lined up for implementation.

1 Like

thanks!! :+1:

Thanks Mark,
Is paying for this priority update an option?