API v8: adding account email addresses

Hi everyone!

How is someone supposed to use the v8 API to add an email address to an Account? :slight_smile:
I’ve tried adding it contextually to the Account creation (using the “relationships” parameter) but it looks like SuiteCRM expects the email address to already exist? If that’s the case, how do I create an EmailAddress bean? There’s no “EmailAddress” module that I can POST to, afaik.

Thanks in advance!

I stand corrected, there’s an “EmailAddresses” module that I can use :slight_smile: I’ll try creating the email addresses and the binding them to the Account object

YES it worked! :smiley: For the record, here’s what I am POSTing:

POST v8/modules/EmailAddresses
{'data': {'attributes': {'email_address': 'email1@test.com',
                         'email_address_caps': 'EMAIL1@TEST.COM'},
          'type': 'EmailAddresses'}}
POST v8/modules/EmailAddresses
{'data': {'attributes': {'email_address': 'email2@test.com',
                         'email_address_caps': 'EMAIL2@TEST.COM'},
          'type': 'EmailAddresses'}}
POST v8/modules/Accounts
{'data': {'attributes': {'account_type': 'CP',
                         'billing_address_city': 'test',
                         'billing_address_country': 'test1',
                         'billing_address_postalcode': 'test2',
                         'billing_address_state': 'test3',
                         'billing_address_street': 'test4',
                         'description': 'testing API',
                         'name': 'random name',
                         'phone_fax': 'random fax',
                         'phone_office': 'random phone',
                         'website': 'www.site.com'},
          'relationships': {'email_addresses': {'data': [{'id': '11a64ca8-fe92-9d8e-22f1-5b45cf4f7e88',
                                                          'type': 'EmailAddress'},
                                                         {'id': '28f7bc22-7ebc-6560-01e3-5b45cfcd47cf',
                                                          'type': 'EmailAddress'}]}},
          'type': 'Accounts'}}

(the ids are returned by the first two POSTs)