Development/Seeding: Difference between revisions

From MusicBrainz Wiki
Jump to navigationJump to search
m (→‎Add Label: whyyyyy does the visual editor keep breaking external links?)
m (try to fix page links yet again)
Line 1: Line 1:
Forms for creating new MusicBrainz entities can be “seeded” with values supplied via POST-ed <code>multipart/form-data</code> body parameters (for the [https://musicbrainz.org/release/add 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]].
Forms for creating new MusicBrainz entities can be “seeded” with values supplied via POST-ed <code>multipart/form-data</code> body parameters (for the [[mb:release/add|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 ==
== Add Release ==
Line 7: Line 7:
Most non-release forms can be seeded via URL query parameters sent via GET requests.
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 <code>name</code> attribute. For example, the [https://musicbrainz.org/artist/create Add Artist] page's “Name” field is defined in the page source as <code><input ... name="edit-artist.name" ...></code>, and a URL like https://musicbrainz.org/artist/create?edit-artist.name=My+Name will initialize the field to the text “My Name”.
In almost all cases, a form input can be seeded by passing a parameter corresponding to input's <code>name</code> attribute. For example, the [[mb:artist/create|Add Artist]] page's “Name” field is defined in the page source as <code><input ... name="edit-artist.name" ...></code>, 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 <code>1</code>.
To set a checkbox input, pass the value <code>1</code>.
Line 13: Line 13:
The following pages support seeding:
The following pages support seeding:


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


Line 36: Line 36:
* '''External Links''' (<code>edit-artist.url.0.text</code>, <code>.0.link_type_id</code>, etc.) accepts paired URL strings and values from the <code>link_type</code> table's <code>id</code> column.
* '''External Links''' (<code>edit-artist.url.0.text</code>, <code>.0.link_type_id</code>, etc.) accepts paired URL strings and values from the <code>link_type</code> table's <code>id</code> column.


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


=== [https://musicbrainz.org/label/create Add Label] ===
=== [[mb:label/create|Add Label]] ===


=== [[mb:recording/create|Add Standalone Recording]] ===
=== [[mb:recording/create|Add Standalone Recording]] ===

Revision as of 13:38, 17 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

Inputs are seeded as described above, with the following notes:

  • Type (edit-artist.type_id) corresponds to the artist_type table's id column.
  • Gender (edit-artist.gender_id) corresponds to the gender table's id column.
  • Area (edit-artist.area.name) contains text used to fill the field for searching.
  • IPI codes (edit-artist.ipi_codes.0, .1, etc.) can be set using multiple parameters.
  • ISNI codes (edit-artist.isni_codes.0, .1, etc.) can be set using multiple parameters.
  • Began (edit-artist.period.begin_date.year, .month, .day) accepts integer values for each parameter.
  • Ended (edit-artist.period.end_date.year, .month, .day) is similar to Began.
  • Relationships are seeded using multiple parameters prefixed with rels.0. rather than the usual edit-artist. prefix. Multiple relationships can be seeded using prefixes like rels.1..
    • rels.0.target contains the target entity's MBID or name (for searching).
    • rels.0.type contains a value from the link_type table's id column.
    • rels.0.source_credit and rels.0.target_credit contain alternate “credited as” strings for the source and target entities.
    • rels.0.begin_date and rels.0.end_date accept a date as YYYY-MM-DD, YYYY-MM, or YYYY.
    • rels.0.ended is 1 if the relationship has ended.
    • rels.0.backward is 1 if the relationship's direction should be reversed.
    • Relationship attributes are seeded using parameters prefixed with rels.0.attributes.0.:
      • rels.0.attributes.0.type contains a value from the link_attribute_type table's id column.
      • rels.0.attributes.0.credited_as contains a string for the “credited as” field, e.g. describing how an instrument was credited.
      • rels.0.attributes.0.text_value 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 (edit-artist.url.0.text, .0.link_type_id, etc.) accepts paired URL strings and values from the link_type table's id column.

Add Event

Add Label

Add Standalone Recording

Add Work