Possible to edit existing item with updated JSON?
Maybe this is obvious and I'm overthinking it, but is it possible to round-trip the JSON returned by op get item
?
I'd like to ingest that JSON, make several changes to the "details" dictionary, then provide that updated JSON (or the details dictionary within) as input to op
in order to apply those changes.
Thanks,
Zach
1Password Version: Not Provided
Extension Version: Not Provided
OS Version: Not Provided
Sync Type: Not Provided
Comments
-
Hey @zcutlip ,
You can definitely build a script to do that.
Using theop get item --format JSON
command, you can output the details of an item (or specific fields of an item by your choosing) as shown here: https://support.1password.com/command-line-reference/#get-itemThen, return the data in the same format after you edit it using the
op edit item
command, as shown here: https://support.1password.com/command-line-reference/#edit-itemAs long as you address the fields with the same JSON short name, things should work.
Does this help?0 -
Then, return the data in the same format after you edit it using the op edit item command, as shown here: https://support.1password.com/command-line-reference/#edit-item
That does help a bit, but my main reason for wanting to feed modified JSON into an edit request is it allows changes that I don't think are possible via
op edit item
So for example: I'm adding SSH key passphrases to a Server item.
Things I can do:- Create the server item from a json template with a custom "SSH KEYS" section
- Have the custom section pre-populated with fields for each SSH key I want to set a password for
Things I don't think I can do via the CLI:
- Add the SSH KEYS (or any other) section after the fact
- Add a new entry to the SSH KEYS section after the fact
So it appears
op edit item
is limited to changing the values of existing fields, but there's no way to add new sections or fields...I think?0 -
I do hope you'll find it useful for now. We do plan on improving things so stay tuned :)
0