You can try this command:
token=$(curl -X Post "http://domain/rest/V1/integration/admin/token"\
-H "Content-Type:application/json"\
-d '{"username":"<admin_user>", "password":"<admin_password>"}')\;
curl -X POST "http://domain/rest/default/V1/customers"\
-H "Content-Type:application/json"\
-H "Authorization:Bearer "$token\
-d '{"customer":{"email":"[email protected]", "firstname": "Example", "lastname": "Example", "id_card": "123456", "tos": "Yes"},"password":"12345678"}'
Explain: according to the official document you provided,
token=$(curl -X Post "http://domain/rest/V1/integration/admin/token"\
-H "Content-Type:application/json"\
-d '{"username":"<admin_user>", "password":"<admin_password>"}');
is getting admin token, and then store the result to a variable called $token
. And then
curl -X POST "http://domain/rest/default/V1/customers"\
-H "Content-Type:application/json"\
-H "Authorization:Bearer "$token\
-d '{"customer":{"email":"[email protected]", "firstname": "Example", "lastname": "Example"},"password":"12345678"}'
is creating customer part.
I've tested this on M2.1.7, but should be more or less the same on M2.2.