How Can I get and add new company via Rest API.
See this thread:
@John_Borelli: Sorry, but I couldn’t get to your reply. Would you please elaborate it? Also where can I get the information about “AccountId”?
For clarity, I need to create, update, and retrieve existing and new company (As a hotel) via REST API.
REST can create contact. Companies are contact records with one specific difference…the field ‘AccountId’ is set to be the same as the ‘Id’ field. That’s how IS knows it’s a company record. So create the contact and then set AccountId to the same value as Id and you’ll have a company record.
@Ravi_Ranjan We have yet to add a Companies resource to the REST API. For now, you’ll need to use the XML-RPC API.
/contacts resource does not allow manipulation of Companies.
Are you saying that you can’t set the AccountId field on a contact using the REST implementation? I wouldn’t think that creating a contact would be restricted in being able to write to the same fields that we’ve always been able to write to so I just wanted to be sure?
The REST API will have separate resources for Contacts and Companies. They will likely end up looking/feeling different than what folks may be used to with the XML-RPC API.
So, in this case, hypothetically,
AccountId would not be a field on Contacts but would rather be a field on Companies. (I use this as an illustration; it’s not guarantee of the future.)
k, so that’s not how the tables are structured at this time. Does this mean they’ve already changed? The question still remains, can a field that currently exists on the contact table, like AccountId, be updated. The defining principle here is that companies are currently stored in the contact table (there is no company table but rather just a view of company records stored on the contact table). Is that schema going to change? If not then this can still be done as I’ve described.
Is there a way to create a new company record via the REST API or otherwise?
Thank you @mike.christianson
@John_Borelli : I tried the way you recommended but I am receiving error as “message”: “Input could not be converted to a valid request”. Would you be able to help me with request file if any? Here is what I’m trying with:
“company_name”: “Test IBC hotels Dont-Book”,
you don’t set the accountid of the company. You set the account id to the IS id value on the contact. From that point forward it will be a company.
That may work, but would be unsupported. The to-be-created Companies resource would be the proper way.
unsupported is understood, however, in the absence of viable methods one overcomes with discovery. This is just what I’ve discovered to be true