Adding project to group using API

The Gitlab API appears to describe two distinct ways to add a project to a group. The first way requires the use of the following endpoint:

POST /groups/:id/projects/:project_id

The second way requires use of the following endpoint

POST /projects/:id/share

I do notice that the second way does not require specification of the group ID, which makes me think it is more of a way to allow a group to be shared in general.

Is my intuition correct here? Is running the second request a prerequisite to running the first? If so, why does the documentation not mention it anywhere?