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.
NB: the /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.
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â: {
âcompany_nameâ: âTest IBC hotels Dont-Bookâ,
âAccountIdâ: 0
}
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
@Ravi_Ranjan Weâre happy to announce: