[TASK] Add extension key to API

Instead of relying on a "magic" global $_EXTKEY
being set, add a new parameter to API where
this was used beforehand.

Resolves: #59770
Releases: 6.2, 6.3
Change-Id: I531bb6067d79aa42c9c592e88f3564dc7f40b29d
Reviewed-on: https://review.typo3.org/31235
Reviewed-by: Anja Leichsenring
Tested-by: Anja Leichsenring