How to set field names?

mwean
mwean
Community Member

Hi, I'm trying to use the CLI for some automation, but I'm having trouble with selecting specific fields. In the .details.fields section, there are entries with a "designation", "name", and sometimes "id". It seems like the designation is what sets a field as the username or password at the top of the 1Password window, but for the rest of the fields, the label of the field uses the "name" value. It's also weird that I have to go to the saved form details to choose the field to set as username/password and change their names. I also see that manually-added fields go in a completely different section of the json response (.details.sections) and the name is stored in a field named "t".

Is there any schema or mental model I can use to make sense of all this?


1Password Version: Not Provided
Extension Version: Not Provided
OS Version: Not Provided
Sync Type: Not Provided

Comments

  • ag_yaron
    ag_yaron
    1Password Alumni

    Hey @mwean

    If you check out our our reference guide in the "Create Item" section, it explains first how to set values in existing fields (e.g. the username/password/website fields).

    Anything after these fields of a login item is considered a custom field, which you'll need to designate in a different section. For that, I recommend that you manually create an example login in your desktop app, then export it as a template JSON (explained in the link above in the "Create item with a template" section).

    You can get a template from any item type, not just logins. I hope that once you'll have a proper template with everything you need, things will get easier :)

  • mwean
    mwean
    Community Member

    I'm actually talking about items created and edited in the app. I'm just trying to read the values with the CLI, but they seem completely inconsistent. I guess I could use the CLI to update all the items to use a consistent naming, but that's an awful lot of hassle...

  • ag_yaron
    ag_yaron
    1Password Alumni

    Yes, if you edited them in the desktop app and created custom fields, then the naming would be quite different between each one.

    If you want to automate things with the CLI, then you'll have to sweep through it all once which is indeed a hassle, but the end result of automation is often worth it :)

This discussion has been closed.