How create multiple links(relation ship) with bulk API

Hello,

I am doing rest bulk call.

I want to create multiple relationships along with the bulk record creation/updation.

Please advise.

Thanks

Sanket

Parents
  • Hi ,

    I advise you to check our  Onboarding Framework Integrations section, it has a lot of good materials there.

    In your case, you can use this endpoint and add multiple requests to one single bulk call, however, it requires you to have both Sugar IDs (GUIDs generated) to make it happen.

    If your use case allows you to, for the best possible performance, use our upsert API in combination with sync_keys.

    Here is an example of the Bulk API request:

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    {"requests":
    [
    {
    "url": "/v11/integrate/Accounts/sync_key/ACC0001/link/contacts/sync_key/CON0001", "method": "PATCH"
    },
    {
    "url": "/v11/integrate/Accounts/sync_key/ACC0001/link/contacts/sync_key/CON0002", "method": "PATCH"
    }
    ]
    }
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    SugarCRM | Principal Developer Advocate

  • Rafael,

    Thank You for Your quick response.

    Is it possible to relate existing record at the time of bulk record creation?

    Like at the time of new contact creation and We can pass the relation field value (e.g.  ilnked_account field name in contact).

  • Hi ,

    The only way is to have sync_keys in place, for that, you would need to create all the main records first (let's say create all accounts then create all contacts), then you connect them all through sync_keys in a subsequent call.

    SugarCRM | Principal Developer Advocate

  • Rafael,

    If We strictly stick to the sync_key then what to do with the existing records before starting with the sync?

    Can We update the sync_key value for those records?

    Please advise

  • Rafael,

    Can We use any other field instead of sync_key?

  • yes sure you can, instead of sync_key, specify your own field... but why would you not use sync_key? synckey is the sugar field name, with the advantage that all modules have that field as well it is indexed.

    SugarCRM | Principal Developer Advocate

Reply
  • yes sure you can, instead of sync_key, specify your own field... but why would you not use sync_key? synckey is the sugar field name, with the advantage that all modules have that field as well it is indexed.

    SugarCRM | Principal Developer Advocate

Children