Forum Discussion

mmerrill's avatar
mmerrill
New Contributor
21 days ago

How to create an Address field type using the CLI?

I'm using the CLI to create an Identity item. The default Identity template has an example "ADDRESS" type, but fails to create an address with any value other than an empty string. I want to create the default address type not a STRING field.

Template Example Field Type:

{
  "id": "address",
  "section": {
    "id": "address",
    "label": "Address"
  },
  "type": "ADDRESS",
  "label": "address",
  "value": ""
}

JSON Copied from Identity Item:

{
  "name": "address",
  "title": "Address",
  "fields": [
    {
      "k": "address",
      "n": "address",
      "t": "address",
      "v": {
        "city": "New York City",
        "country": "us",
        "state": "New York",
        "street": "123 4th Street",
        "zip": "12345"
      }
    }
  ]
}

The error when you pass in a non-empty string is:

'[ERROR] validateVaultItem failed to Validate: Couldn't validate the item: "[ItemValidator] has found 1 errors, 0 warnings: \\nErrors:{1. details.sections[1].fields[0].v has invalid type: \\"string\\". Requires one of [object] value}"\n'

The error when you pass in an object is:

'[ERROR] invalid JSON template: json: cannot unmarshal object into Go struct field ItemField.fields.value of type string\n'

How do you create an address if not a string or an object?

1 Reply

  • Hi mmerrill​ ,

    I just wanted to drop a note and let you know i'm looking into this. I've also requested an update to the "op item get template" command to include examples for objects like this so you don't have to dig as much.

    I hope to hear back from the team in the next day or so.

    Thanks in advance for your patience,
    Phil