DRY: Remove some repetition in the ID API POST requests

It's quite fiddly to get rid of all the repetition without using some kind
of builder pattern, but this is a start.

This is a reapplication of commit 08615842 from PR #3759, which was
reverted with commit 1a3d221d.
Merge branch 'master' of github.com:guardian/frontend