SOLVED

Re: Query Companies

Go to solution
Michael_Florin
Level 10

Query Companies

Hi all,

 

I'm trying to understand how querying and creating Marketo companies works through the API. Here's what I'm struggling with specifically:

When I query companies like this from Postman:

 

 

{{base_url}}/rest/v1/companies.json?filterType=externalCompanyId&filterValues=1000244485

 

 

I get this result:

 

{
    "requestId": "de8d#17bff2da213",
    "result": [],
    "success": true
}

 

I've tried various filterTypes like "id" or "company" and "externalCompanyId" as seen above, but the result was never not empty.


Here's what the description of the company object looks like: ({{base_url}}/rest/v1/companies/describe.json)

 

 "result": [
        {
            "name": "Company",
            "description": "Map for API company fields",
            "createdAt": "2019-03-22T17:37:45Z",
            "updatedAt": "2019-03-22T17:37:45Z",
            "idField": "id",
            "dedupeFields": [
                "externalCompanyId"
            ],
            "searchableFields": [
                [
                    "externalCompanyId"
                ],
                [
                    "id"
                ],

 

and some more lines. So I should be able to use "id" and "externalCompanyId" as filterTypes, right?

 

How would I see "id" and "externalCompanyID" in the UI? External Company ID is a hidden system field (???) and what's ID? Is that what I get if I run this CDV?

 

Michael_Florin_0-1632074474291.png

That creates a field value for "Flexfield 1" but if I use that in the query:

 

 

{{base_url}}/rest/v1/companies.json?filterType=id&filterValues=1837

 

 

I don't get anything either.


What am I missing here?


-----------


And question two is this: How would I proceed if I wanted to insert/update "contacts" through a non-native sync. Create companies first and then leads by linking them to "externalCompanyId". Or does this work in just one call?


Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Query Companies


Probably not. I assume that there were just lead list imports into lead and company fields, where something like an "Internal SAP Company ID" holds it all together. So probably there are no companies in that instance, which would mean, no "externalCompanyId" was ever populated.

 

Marketo's {{company.id}} would exist regardless, right?


Pretty sure the standard non-REST-inserted Companies can’t be used in this scenario.

View solution in original post

4 REPLIES 4
SanfordWhiteman
Level 10 - Community Moderator

Re: Query Companies


How would I proceed if I wanted to insert/update "contacts" through a non-native sync. Create companies first and then leads by linking them to "externalCompanyId".

Yes, 2 calls.

 

For your 1st question, did you create a company using the REST API first?

Katja_Keesom
Level 10 - Community Advisor

Re: Query Companies

In addition to Sandford's question, I would recommend specifying the fields you want to retrieve on your Companies query call by simply adding &fields=company,annualRevenue (as example fields).

Michael_Florin
Level 10

Re: Query Companies

@Katja_Keesom - I tried that, but to no avail. And if I understand the documentation correctly, with omitted parameter "fields" the call should still return four default fields.

@SanfordWhiteman - hmm, that might be the key question, and I don't know that answer. Probably not. I assume that there were just lead list imports into lead and company fields, where something like an "Internal SAP Company ID" holds it all together. So probably there are no companies in that instance, which would mean, no "externalCompanyId" was ever populated.

 

Marketo's {{company.id}} would exist regardless, right?

SanfordWhiteman
Level 10 - Community Moderator

Re: Query Companies


Probably not. I assume that there were just lead list imports into lead and company fields, where something like an "Internal SAP Company ID" holds it all together. So probably there are no companies in that instance, which would mean, no "externalCompanyId" was ever populated.

 

Marketo's {{company.id}} would exist regardless, right?


Pretty sure the standard non-REST-inserted Companies can’t be used in this scenario.