Command Line Client/Create Projects and Records

The command dx new provides subcommands for creating projects and records.

Creating a Project

You can create a project by using the command dx new project.

$ dx new project "Project X"
Created new project called "Project X" (project-B0q984qJYJ06537FbvP0006K)

Note that you can suppress the extra English output and just have the project ID printed using ‑‑brief.

$ dx new project "Project Y" --brief
project-B0q98YzqVKy6537FbvP0006Q

If you would like to rename the project later, you can do so using the dx rename command. Just remember that if you are referring to the project by name rather than ID, you will need to append a colon (":") or else it will attempt to rename the data object in your current project with that same name. (For more on the path syntax, see the section on Path Resolution.)

Creating a Record

You can create a record by using the command dx new record. If no output name is specified with ‑o/‑‑output, the new object's ID will be used for its name. You can specify all metadata at creation time.

$ dx new record -o myfolder/recordname --property foo=bar --type example --details '{"hello": "world"}' -p ID record-B0q9FJjzPGJX389YZGP000Pp Class record Project project-B0q7B6jzPGJX389YZGP0003J Folder /myfolder Name recordname State open Visibility visible Types example Properties foo=bar Tags - Details {"hello": "world"} Outgoing links - Created Thu Aug 23 13:42:31 2012 Created by alice Last modified Thu Aug 23 13:42:31 2012

Again, you can suppress the verbose output with the ‑‑brief flag to only print the new record's ID.

$ dx new record --brief
record-B0q9Gk0zPGJf537FbvP0006X

After creating a record, there are dx commands for modifying any of the metadata fields (see the Manage Metadata section for a complete list of commands). You can also close the record with dx close if you would like to freeze the visibility, types, and details fields. This also allows you to clone the record into other projects using dx cp (see the section on copying data between projects for more details).

Copying a Record by Value

You can also create a shallow copy of another record, essentially initializing all metadata fields from those of another. Note as follows that any metadata fields specified in the command (such as ‑‑types) will override the metadata values found in the original record used for initialization.

$ dx new record --init myfolder/recordname --type example2 -o myfolder/second_record ID record-B0q9P2QzPGJf537FbvP0006Z Class record Project project-B0q7B6jzPGJX389YZGP0003J Folder /myfolder Name second_record State open Visibility visible Types example2 Properties foo=bar Tags - Details {"hello": "world"} Outgoing links - Created Thu Aug 23 13:50:18 2012 Created by alice Last modified Thu Aug 23 13:50:18 2012

Last edited by Thanh-Ha Nguyen, 2016-06-09 15:51:58

 Feedback