Item creation template changed ? not backward compatible ?

mickael
mickael
Community Member
edited September 2022 in CLI

Hi,

I have upated op cli to 2.7.0. Sadly, I don'( know which version I was using previously.

I noticed that now op cli requires the --category parameter even if ithis is in the template.

But, not a big deal.

However, it looks like the JSON template to create entries has changed.

My entries are created but I get no fields displayed in 1password

Where can I find the reference for creating new items ?

Should I create a new entry and inspect that one ?

If yes, should I use the template from op item get or from 1Password copy json ? They are quite different.

Are those changes displayed in the releases notes ?

This is something very important for our tools we developed under op cli.

Thanks


1Password Version: Not Provided
Extension Version: Not Provided
OS Version: Not Provided
Browser:_ Not Provided

Comments

  • mickael
    mickael
    Community Member

    For example, my current command:

    op item create --no-color --format json --category=Server --title="USER test ON test.fr"
    

    with the given file as input

    {
      "category": "SERVER",
      "version": 1,
      "fields": [
        {
          "id": "notesPlain",
          "type": "STRING",
          "purpose": "NOTES",
          "label": "notesPlain"
        },
        {
          "inputTraits": {
            "keyboard": "URL"
          },
          "type": "STRING",
          "id": "url",
          "value": "ssh://test@test.fr",
          "label": "URL"
        },
        {
          "inputTraits": {
            "autocapitalization": "none",
            "autocorrection": "no"
          },
          "type": "string",
          "id": "ukjbjgldzwhtooqsrckhevwnjb",
          "value": "test",
          "label": "username",
          "section": {
            "id": "Section_awspsnhgvdzexvxppltsmzeakkjzg"
          }
        },
        {
          "type": "concealed",
          "id": "arxsuhneodbxhdremivxasviec",
          "value": "=pMsXKtWgZhS9FivQA=fpNxxU",
          "label": "password",
          "section": {
            "id": "Section_awspsnhgvdzexvxppltsmzeakkjzg"
          }
        },
        {
          "inputTraits": {
            "keyboard": "URL"
          },
          "type": "string",
          "id": "moaexaqdboylwiukwkaetrfonv",
          "label": "admin console URL",
          "section": {
            "id": "Section_nzfkxrxlcwmphxkikubsqpzmwptnm"
          }
        },
        {
          "inputTraits": {
            "autocapitalization": "none",
            "autocorrection": "no"
          },
          "type": "string",
          "id": "dmoerajyuxuyvcfafikhaipagv",
          "label": "admin console username",
          "section": {
            "id": "Section_nzfkxrxlcwmphxkikubsqpzmwptnm"
          }
        },
        {
          "type": "concealed",
          "id": "tflbqvcocujwedpmjrxjbkwmoj",
          "label": "console password",
          "section": {
            "id": "Section_nzfkxrxlcwmphxkikubsqpzmwptnm"
          }
        },
        {
          "inputTraits": {
            "autocapitalization": "Words"
          },
          "type": "string",
          "id": "nifziizgtmboemtniresdthyre",
          "label": "name",
          "section": {
            "id": "Section_cqlooydmgwidagrwieizdiwrwdkef"
          }
        },
        {
          "inputTraits": {
            "keyboard": "URL"
          },
          "type": "string",
          "id": "xarkqcnqggfeermdkkagikvzgc",
          "label": "website",
          "section": {
            "id": "Section_cqlooydmgwidagrwieizdiwrwdkef"
          }
        },
        {
          "inputTraits": {
            "keyboard": "URL"
          },
          "type": "string",
          "id": "egfiqayozvcguuzlzfopbskkko",
          "label": "support URL",
          "section": {
            "id": "Section_cqlooydmgwidagrwieizdiwrwdkef"
          }
        },
        {
          "inputTraits": {
            "keyboard": "NamePhonePad"
          },
          "type": "string",
          "id": "zrfeelqtvejospovdanqmfsdpp",
          "label": "support phone",
          "section": {
            "id": "Section_cqlooydmgwidagrwieizdiwrwdkef"
          }
        },
        {
          "label": "UUID",
          "value": "fdefce4d-0952-4e8a-92b3-6ec4199b8490",
          "type": "STRING",
          "id": "fclstqilqjwjprbnkatndafyrf",
          "section": {
            "title": "",
            "name": "Section_wedzcvagjsafazneugpgpuanskahw"
          }
        }
      ],
      "sections": [
        {
          "id": "Section_awspsnhgvdzexvxppltsmzeakkjzg"
        },
        {
          "id": "Section_nzfkxrxlcwmphxkikubsqpzmwptnm"
        },
        {
          "id": "Section_cqlooydmgwidagrwieizdiwrwdkef"
        },
        {
          "title": "",
          "name": "Section_wedzcvagjsafazneugpgpuanskahw"
        }
      ]
    }
    

    A template retrieven from CLI after creating an entry from 1Password app:

    {
      "id": "k3qakpbjnjs64nwetfbam62hpu",
      "title": "Serveur de test",
      "version": 1,
      "vault": {
        "id": "iv263o6a42clpqbhrefi4jjh5y",
        "name": "Private"
      },
      "category": "SERVER",
      "last_edited_by": "P5VU2BKG4NANTOCO4WBEKBBHUY",
      "created_at": "2022-09-15T15:08:12Z",
      "updated_at": "2022-09-15T15:08:12Z",
      "additional_information": "username",
      "sections": [
        {
          "id": "admin_console",
          "label": "Console d'administration"
        },
        {
          "id": "hosting_provider_details",
          "label": "Fournisseur d'hébergement"
        }
      ],
      "fields": [
        {
          "id": "notesPlain",
          "type": "STRING",
          "purpose": "NOTES",
          "label": "notesPlain",
          "reference": "op://Private/Serveur de test/notesPlain"
        },
        {
          "id": "url",
          "type": "STRING",
          "label": "URL",
          "value": "ssh://url",
          "reference": "op://Private/Serveur de test/URL"
        },
        {
          "id": "username",
          "type": "STRING",
          "label": "Nom d'utilisateur",
          "value": "username",
          "reference": "op://Private/Serveur de test/username"
        },
        {
          "id": "password",
          "type": "CONCEALED",
          "label": "mot de passe",
          "value": "password",
          "reference": "op://Private/Serveur de test/mot de passe"
        },
        {
          "id": "admin_console_url",
          "section": {
            "id": "admin_console",
            "label": "Console d'administration"
          },
          "type": "STRING",
          "label": "URL console d'admin.",
          "reference": "op://Private/Serveur de test/admin_console/admin_console_url"
        },
        {
          "id": "admin_console_username",
          "section": {
            "id": "admin_console",
            "label": "Console d'administration"
          },
          "type": "STRING",
          "label": "identifiant de console d'admin.",
          "reference": "op://Private/Serveur de test/admin_console/admin_console_username"
        },
        {
          "id": "admin_console_password",
          "section": {
            "id": "admin_console",
            "label": "Console d'administration"
          },
          "type": "CONCEALED",
          "label": "mot de passe console",
          "reference": "op://Private/Serveur de test/admin_console/mot de passe console"
        },
        {
          "id": "name",
          "section": {
            "id": "hosting_provider_details",
            "label": "Fournisseur d'hébergement"
          },
          "type": "STRING",
          "label": "nom",
          "reference": "op://Private/Serveur de test/hosting_provider_details/nom"
        },
        {
          "id": "website",
          "section": {
            "id": "hosting_provider_details",
            "label": "Fournisseur d'hébergement"
          },
          "type": "STRING",
          "label": "site web",
          "reference": "op://Private/Serveur de test/hosting_provider_details/site web"
        },
        {
          "id": "support_contact_url",
          "section": {
            "id": "hosting_provider_details",
            "label": "Fournisseur d'hébergement"
          },
          "type": "STRING",
          "label": "URL du support",
          "reference": "op://Private/Serveur de test/hosting_provider_details/URL du support"
        },
        {
          "id": "support_contact_phone",
          "section": {
            "id": "hosting_provider_details",
            "label": "Fournisseur d'hébergement"
          },
          "type": "STRING",
          "label": "n° téléphone assistance",
          "reference": "op://Private/Serveur de test/hosting_provider_details/support_contact_phone"
        }
      ]
    }
    

    The same entry from JSON export of 1Password app:

     {
      "overview": {
        "title": "Serveur de test",
        "ainfo": "username"
      },
      "details": {
        "sections": [
          {
            "name": "",
            "title": "",
            "fields": [
              {
                "t": "URL",
                "n": "url",
                "k": "string",
                "v": "ssh://url",
                "inputTraits": {
                  "keyboard": "URL"
                }
              },
              {
                "t": "Nom d'utilisateur",
                "n": "username",
                "k": "string",
                "v": "username",
                "inputTraits": {
                  "autocorrection": "no",
                  "autocapitalization": "none"
                }
              },
              {
                "t": "mot de passe",
                "n": "password",
                "k": "concealed",
                "v": "password"
              }
            ]
          },
          {
            "name": "admin_console",
            "title": "Console d'administration",
            "fields": [
              {
                "t": "URL console d'admin.",
                "n": "admin_console_url",
                "k": "string",
                "inputTraits": {
                  "keyboard": "URL"
                }
              },
              {
                "t": "identifiant de console d'admin.",
                "n": "admin_console_username",
                "k": "string",
                "inputTraits": {
                  "autocorrection": "no",
                  "autocapitalization": "none"
                }
              },
              {
                "t": "mot de passe console",
                "n": "admin_console_password",
                "k": "concealed"
              }
            ]
          },
          {
            "name": "hosting_provider_details",
            "title": "Fournisseur d'hébergement",
            "fields": [
              {
                "t": "nom",
                "n": "name",
                "k": "string",
                "inputTraits": {
                  "autocapitalization": "Words"
                }
              },
              {
                "t": "site web",
                "n": "website",
                "k": "string",
                "inputTraits": {
                  "keyboard": "URL"
                }
              },
              {
                "t": "URL du support",
                "n": "support_contact_url",
                "k": "string",
                "inputTraits": {
                  "keyboard": "URL"
                }
              },
              {
                "t": "n° téléphone assistance",
                "n": "support_contact_phone",
                "k": "string",
                "inputTraits": {
                  "keyboard": "NamePhonePad"
                }
              }
            ]
          }
        ]
      },
      "createdAt": "2022-09-15T15:08:12Z",
      "updatedAt": "2022-09-15T15:08:12Z",
      "faveIndex": 0,
      "trashed": "N",
      "templateUuid": "110",
      "uuid": "k3qakpbjnjs64nwetfbam62hpu"
    }
    
  • mickael
    mickael
    Community Member

    I did some test with each latest releases of op cli.
    It looks like things were working until 2.6.1 and 2.6.2 broke the item creation process.

  • Hi @mickael ! You could get a valid item template for a LOGIN type, for example, by using the command op item template get LOGIN. Then this command op item template get LOGIN | op item create - (without needing to specify the --category flag) would create a new item for you. You can start from the provided template and edit your way up to more complex items.

    All the best,
    Andi

This discussion has been closed.