I tried to follow the steps that are defined in the link "https://didproject.azurewebsites.net/docs/registration.html" as is with out any changes to create a sample and complete DID registration to understand the process.
I downloaded the sample and generated necessary public/private keys and completed till the step to generate the payload using the command node makejws which is successful.
After this when i am trying to use the curl command "curl" by replacing the entire text after -- data with the response of payload from the command node makejws . I am receiving an error as Bad request and not sure what is wrong in the command
Curl command that i used is as below
curl -v -H "Content-Type: application/json" --data "{'header':{'alg':'ES256K','kid':'#key-1','operation':'create','proofOfWork':'{}'},'payload':'eyJAY29udGV4dCI6Imh0dHBzOi8vdzNpZC5vcmcvZGlkL3YxIiwicHVibGljS2V5IjpbeyJpZCI6IiNrZXktMSIsInR5cGUiOiJTZWNwMjU2azFWZXJpZmljYXRpb25LZXkyMDE4IiwicHVibGljS2V5SndrIjp7Imt0eSI6IkVDIiwia2lkIjoiI2tleS0xIiwiY3J2IjoiUC0yNTZLIiwieCI6IjVvTEg2ZUVfdWZjZ2VlZ1U2NFo1ZFlEdUxjWWJSV3hsYk1xdFVnbmVRRWMiLCJ5IjoieXZEcXhwaXlCYlZsUlF1cXhHUm54U3hNbDJwSFFTem5Ub0U1dTZKMzBkSSIsInVzZSI6InZlcmlmeSIsImRlZmF1bHRFbmNyeXB0aW9uQWxnb3JpdGhtIjoibm9uZSIsImRlZmF1bHRTaWduQWxnb3JpdGhtIjoiRVMyNTZLIn19XSwic2VydmljZSI6W3siaWQiOiJJZGVudGl0eUh1YiIsInR5cGUiOiJJZGVudGl0eUh1YiIsInNlcnZpY2VFbmRwb2ludCI6eyJAY29udGV4dCI6InNjaGVtYS5pZGVudGl0eS5mb3VuZGF0aW9uL2h1YiIsIkB0eXBlIjoiVXNlclNlcnZpY2VFbmRwb2ludCIsImluc3RhbmNlIjpbImRpZDp0ZXN0Omh1Yi5pZCJdfX1dfQ','signature':'MEYCIQCb7qxCFyIcYumN-HbYqleTc5YldwRnNrhDzlB1DEubQQIhAMkAdsa-BxwV5EghhLljbr84MjkmUYI5narCTnapBcxs'}" -X POST https://beta.ion.microsoft.com/api/1.0/register
Excepted below response
"HTTP/1.1 200 OK
Content-Length: 395
Content-Type: application/json"
But receiving
HTTP/1.1 400 Bad Request
request-id: "test"
content-type: text/plain; charset=
The curl command you are using is not sending JSON. JSON requires "double quotes" around keys and values.
Change all of your ' to ", and wrap it in ' like so:
When I did that, I received a
HTTP/1.1 200 OK
(Also, the
-X POST
is not necessary -POST
is already implied by other parts of thecurl
command.)UPDATE 1 Based on your 6/30 comment, I have updated this answer with an unabbreviated form of what I mean, with the curl output showing that it works:
full curl command
curl transmission
curl response