Creating Unit Records via Nexus API - "Authorization Header Required"

This is a response to a question about an error received when attempting to create unit records via a POST to the units endpoint.

The correct format for creating unit records when using CURL at this endpoint would be:

terminal@computer:~$ curl \
> -u "my_nexus_username:my_nexus_api_token" \
> -H "Content-Type: application/json" \
> -d '{"product_qid": "PV987654321", "count": 1}'

{"_links": {"self": {"href": ""}},
 "completed_when": null, "created_when": "2021-10-18T12:51:16Z", "error": null, "estimated_time": null, 
"progress": 0.0, "qid": "PR12345678", "requested_by": "my_nexus_username",
"started_when": null, "state": "CREATED"}

The above request/response indicates that the Nexus API has begun a unit creation request for 1 unit record of product QID “PV987654321” (a fake QID in this case). This unit creation request can then be checked for completion via another API call by using the “promise ID” of the result (in this case, “PR12345678”).

To check the progress of the unit creation request, make a GET request to the unit records endpoint:

curl \
> -u "my_nexus_username:my_nexus_api_token"

{"_links": {"result": {"href": ""},
"self": {"href": ""}},
"completed_when": "2021-10-18T12:51:16Z", "created_when": "2021-10-18T12:51:16Z",
"error": null, "estimated_time": 0.0, "progress": 1.0, "qid": "PR12345678",
"requested_by": "my_nexus_username", "started_when": "2021-10-18T12:51:16Z", "state": "COMPLETED"}

The response above shows that the request is completed, and provides the link to download the completed result as the result parameter in the JSON response (in this example, the results URL is

To download the final unit record results CSV, make a GET request to the unit records result URL provided, telling cURL to follow redirects with the -L option, and specifying an output CSV for the results with the --output option:

curl -L --output my_results.csv \
	-u "my_nexus_username:my_nexus_api_token"

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  2795  100  2795    0     0   5512      0 --:--:-- --:--:-- --:--:--  5501
100   146  100   146    0     0    172      0 --:--:-- --:--:-- --:--:--   172

Now, it should be possible to view the contents of a file, my_results.csv, directly. For the above example, lets assume we were creating a Nexus Channel capable unit record using shared symmetric keys. The resulting CSV would look similar to the following:

j@cataflic:~$ cat my_results.csv 
Unit Number,Product Type,Secret Key,Channel Secret Key
1234567890,My Neat Product Name,abcdef1234567890abcdef1234567890,abcdef1234567890abcdef1234567890