Development/Seeding: Difference between revisions

From MusicBrainz Wiki
Jump to navigationJump to search
m (→‎Add Artist: minor grammatical fixes)
(→‎Add Artist: Move to Development/Seeding/Artist_Editor)
Line 14: Line 14:


=== [[mb:artist/create|Add Artist]] ===
=== [[mb:artist/create|Add Artist]] ===
Inputs are seeded as described above, with the following notes:


See [[Development/Seeding/Artist_Editor]].
* '''Type''' (<code>edit-artist.type_id</code>) corresponds to the <code>artist_type</code> table's <code>id</code> column.
* '''Gender''' (<code>edit-artist.gender_id</code>) corresponds to the <code>gender</code> table's <code>id</code> column.
* '''Area''' (<code>edit-artist.area.name</code>) contains text used to fill the field for searching.
* '''IPI codes''' (<code>edit-artist.ipi_codes.0</code>, <code>.1</code>, etc.) can be set using multiple parameters.
* '''ISNI codes''' (<code>edit-artist.isni_codes.0</code>, <code>.1</code>, etc.) can be set using multiple parameters.
* '''Began''' (<code>edit-artist.period.begin_date.year</code>, <code>.month</code>, <code>.day</code>) accepts integer values for each parameter.
* '''Ended''' (<code>edit-artist.period.end_date.year</code>, <code>.month</code>, <code>.day</code>) is similar to '''Began'''.
* '''Relationships''' are seeded using multiple parameters prefixed with <code>rels.0.</code> rather than the usual <code>edit-artist.</code> prefix. Multiple relationships can be seeded using prefixes like <code>rels.1.</code>.
** <code>rels.0.target</code> contains the target entity's MBID or name (for searching).
** <code>rels.0.type</code> contains a value from the <code>link_type</code> table's <code>id</code> column.
** <code>rels.0.source_credit</code> and <code>rels.0.target_credit</code> contain alternate “credited as” strings for the source and target entities.
** <code>rels.0.begin_date</code> and <code>rels.0.end_date</code> accept dates as <code>YYYY-MM-DD</code>, <code>YYYY-MM</code>, or <code>YYYY</code>.
** <code>rels.0.ended</code> is <code>1</code> if the relationship has ended.
** <code>rels.0.backward</code> is <code>1</code> if the relationship's direction should be reversed.
** '''Relationship attributes''' are seeded using parameters prefixed with <code>rels.0.attributes.0.</code>:
*** <code>rels.0.attributes.0.type</code> contains a value from the <code>link_attribute_type</code> table's <code>id</code> column.
*** <code>rels.0.attributes.0.credited_as</code> contains a string for the “credited as” field, e.g. describing how an instrument was credited.
*** <code>rels.0.attributes.0.text_value</code> holds additional text associated with some attribute types, e.g. the actual number when setting the “number” attribute on a recording-series part-of relationship.
* '''External Links''' (<code>edit-artist.url.0.text</code>, <code>.0.link_type_id</code>, etc.) are seeded using paired URL strings and values from the <code>link_type</code> table's <code>id</code> column.


=== [[mb:event/create|Add Event]] ===
=== [[mb:event/create|Add Event]] ===

Revision as of 14:01, 22 July 2023

Forms for creating new MusicBrainz entities can be “seeded” with values supplied via POST-ed multipart/form-data body parameters (for the Add Release page) or URL query parameters (for most other pages). Third-party tools that use seeding to make it easier to import data into MusicBrainz are listed at External Resources.

Add Release

You can seed a new release with a POST request. See the release editor seeding documentation for details.

Other pages (Add Artist, Add Label, Add Standalone Recording, etc.)

Most non-release forms can be seeded via URL query parameters sent via GET requests.

In almost all cases, a form input can be seeded by passing a parameter corresponding to input's name attribute. For example, the Add Artist page's “Name” field is defined in the page source as <input ... name="edit-artist.name" ...>, and a URL like https://musicbrainz.org/artist/create?edit-artist.name=My+Name will initialize the field to the text “My Name”.

To set a checkbox input, pass the value 1.

The following pages support seeding:

Add Artist

See Development/Seeding/Artist_Editor.

Add Event

Add Label

Add Standalone Recording

Add Work