Skip to content

docs: Document Batch add Contacts to Companies REST API endpoint#593

Draft
promptless-for-oss wants to merge 5 commits into
mautic:7.2from
Promptless:promptless/pr-16512-batch-add-contacts-companies-api
Draft

docs: Document Batch add Contacts to Companies REST API endpoint#593
promptless-for-oss wants to merge 5 commits into
mautic:7.2from
Promptless:promptless/pr-16512-batch-add-contacts-companies-api

Conversation

@promptless-for-oss

Copy link
Copy Markdown
Contributor

Open this suggestion in Promptless to view citations and reasoning process

Adds a "Batch add Contacts to Companies" section to the Companies REST API reference for the new POST /companies/batch/addcontacts endpoint (mautic/mautic PR #16512). Covers the assignments request body, per-pair results, summary object, per-pair status values, the batch size limit, and change-log behavior. Targets the 7.2 docs branch per branch-targeting rules (source base 7.x).

Trigger Events


Tip: Enable auto-create PR in your Configuration to review suggestions directly in GitHub 🤖

Add reference for POST /companies/batch/addcontacts (mautic/mautic PR #16512),
covering the assignments request body, per-pair results, summary object,
status values, batch size limit, and change-log behavior.
HTTP request
============

.. vale on

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Documented the new POST /companies/batch/addcontacts endpoint and its purpose from this PR. The route is defined in app/bundles/LeadBundle/Config/config.php (mautic_api_companybatchaddcontacts, POST only) and handled by CompanyApiController::batchAddContactsAction, which reads the assignments array from the request body.

Source: mautic/mautic#16512

Comment thread docs/rest_api/companies.rst Outdated
- object
- Overall counts for the batch

Each entry in ``results`` contains the following properties.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The per-pair status/message values and the summary counts (total, succeeded, failed) come from BatchCompanyContactAssignmentModel in this PR (hard-coded message constants; succeeded counts status-200 pairs, failed counts all others). Overall 200 on processed batches, 400/403 request-level errors, and the 500 returned when the batch exceeds api_batch_max_limit (default 200) via the inherited validateBatchPayload() are all verified against the PR's functional tests.

Source: mautic/mautic#16512

@adiati98 adiati98 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@promptless-for-oss please address the suggestions.

Comment thread docs/rest_api/companies.rst Outdated
Comment thread docs/rest_api/companies.rst Outdated
Comment thread docs/rest_api/companies.rst Outdated
@promptless-for-oss

Copy link
Copy Markdown
Contributor Author

Thanks @adiati98! Addressed all three points:

  1. Capitalized 'Integrations' and reworded the 'reports the outcome' verb to 'includes the outcome' to clear the Mautic.FeatureList Vale warnings.
  2. The 'company' warning was on the literal API response message Contact added to company — that's the exact string this endpoint returns (const MESSAGE_ADDED), so rather than change the API's wording I formatted all the per-pair status message values as inline code literals, which is accurate and clears the warning.
  3. Renamed the request-body heading to 'POST parameters' to match the convention used elsewhere on this page and in forms.rst.

Vale now runs clean on all changed lines. (There's one pre-existing Vale suggestion on line 441 about published → 'Active or Available', but it's on the publishedOnly query parameter outside this PR's section, so I left it untouched.)

@adiati98 adiati98 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@promptless-for-oss please address the suggestions.

Comment thread docs/rest_api/companies.rst Outdated
- string
- Human-readable outcome for the pair

The ``summary`` object contains the following properties.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The ``summary`` object contains the following properties.
The ``summary`` object properties
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Comment thread docs/rest_api/companies.rst Outdated
@promptless-for-oss

Copy link
Copy Markdown
Contributor Author

Thanks @adiati98! These property tables describe the results array entries and the summary object, which are both sub-groups under the h4 "Properties" section (not nested inside summary itself). I've turned the two intro sentences into proper h5 headings — The results entry properties and The summary object properties — consistent with the h5 subsections already used elsewhere on this page (e.g. "Core fields"/"Professional fields"). Vale is clean on the changed lines.

@adiati98 adiati98 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@promptless-for-oss please address the suggestions.

Comment thread docs/rest_api/companies.rst Outdated
Comment thread docs/rest_api/companies.rst Outdated
Convert the plain-sentence 'Per-pair ``status`` values:' intro into a proper
h5 (~) heading 'Per-pair ``status`` values', a peer of the existing
'The ``results`` entry properties' and 'The ``summary`` object properties'
subsections under the h4 'Properties' section. Addresses @adiati98's review on PR mautic#593.
@promptless-for-oss

Copy link
Copy Markdown
Contributor Author

Thanks @adiati98! Addressed the remaining comment. The plain-sentence Per-pair ``status`` values: intro is now a proper h5 heading — Per-pair status values — a peer of the existing The results entry properties and The summary object properties subsections under the h4 "Properties" section.

To clarify the question in your comment: that table describes the status field of each results entry, not the summary object, so it belongs directly under "Properties" as an h5 rather than nested inside summary. Vale is clean on the changed lines.

@adiati98 adiati98 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@promptless-for-oss please address the suggestions.

Comment thread docs/rest_api/companies.rst Outdated
Comment on lines +1150 to +1151
The ``results`` entry properties
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the excess ~ here.

Suggested change
The ``results`` entry properties
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The ``results`` entry properties
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Comment thread docs/rest_api/companies.rst Outdated
Comment on lines +1173 to +1174
The ``summary`` object properties
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The ``summary`` object properties
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The ``summary`` object properties
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Comment thread docs/rest_api/companies.rst Outdated
Comment on lines +1193 to +1194
Per-pair ``status`` values
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Per-pair ``status`` values
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Per-pair ``status`` values
~~~~~~~~~~~~~~~~~~~~~~~~~~

Address @adiati98's review on PR mautic#593: trim excess tildes on the
three property-table h5 headings so each underline matches its
heading text length.
@promptless-for-oss

Copy link
Copy Markdown
Contributor Author

@adiati98 Thanks for the review — done. I shortened the three heading underlines to match the reviewer suggestions exactly:

  • The ``results`` entry properties → 30 ~
  • The ``summary`` object properties → 31 ~
  • Per-pair ``status`` values → 22 ~

The changes are pushed to this branch. Vale is clean on the changed lines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants