Mag
Mag

Reputation: 1

How to sent windows key for google cloud platform as an JSON?

I need to attach the encoded key to the modulus in for windows set metadata rest call to get a user validated for login.

So the format which google expects is:

{
  "fingerprint": string,
  "items": [
  {
    "key": string,
    "value": string
  }
  ],
  "kind": string
}

So when you are sending data to google they want in this format.

{
  "fingerprint": "sfasdfasdfFSN7AuU=",
  "items": [
  {
    "key": "windows-keys",
    "value": "{\"userName\": \"user\",
    \"modulus\": \"somekey\",
    \"exponent\": \"AQAB\",
    \"email\": \"samleemail\",
    \"expireOn\": \"2019-04-14T01:37:19Z\"
   }"
  }
  ]
}

It will also accept if I send the same JSON in this below format but will not perform any action in there:

{
  "fingerprint": "asfasd",
  "items": [
  {
    "key": "windows-keys",
    "value": 
    {
      "userName": "user",
      "modulus": "IEFBQUFCM056YUMxeWM",
      "exponent": "AQAB",
      "email": "somemailt",
      "expiresOn": "2019\"04-14T01:37:19Z" 
    }
  }
  ]
}

Does any one knows a solution for this or faced this issue? Google Doc link

Upvotes: 0

Views: 173

Answers (1)

Alan Dávalos
Alan Dávalos

Reputation: 2708

In the format definition you're providing, it mentions that the value property of every item in the items array should be a string, and if you look closely, the "correct" example you provide sets value as a string`

  {
    "key": "windows-keys",
    "value": "{\"userName\": \"user\",
    \"modulus\": \"somekey\",
    \"exponent\": \"AQAB\",
    \"email\": \"samleemail\",
    \"expireOn\": \"2019-04-14T01:37:19Z\"
   }"
  }

However, in your second example, you're setting value as an object, so it's not in the expected format, the correct version should look something like this:

{
  "fingerprint": "asfasd",
  "items": [
  {
    "key": "windows-keys",
    "value": "{\"userName\": \"user\",
      \"modulus\": \"IEFBQUFCM056YUMxeWM\",
      \"exponent\": \"AQAB\",
      \"email\": \"somemailt\",
      \"expiresOn\": \"2019-04-14T01:37:19Z\" 
    }"
  }
  ]
}

That should make it at least accept your request, you might need to fill the email with a correct one and check out whether if it's "expireOn" or "expiresOn" as your examples use both

Upvotes: 1

Related Questions