Difference between revisions of "User:Bitmap/Relationship Editor Parameters"

From MusicBrainz Wiki
Jump to navigationJump to search
(it's not "errors" it's "error")
(fix the example)
 
(4 intermediate revisions by 2 users not shown)
Line 21: Line 21:
   
 
; entity.''n''.gid
 
; entity.''n''.gid
: The MBID of entity '''''n''''' in the relationship. Required.
+
: The MBID of entity '''''n''''' in the relationship. Required unless a url is specified instead (see below).
 
:
 
:
 
: '''''n''''' is either "0" or "1". The entities must be in the correct order for their link type (e.g. for an artist-recording relationship, the artist must be entity.0 and the recording must be entity.1). See http://musicbrainz.org/relationships for a list of relationship types and the direction of their entities.
 
: '''''n''''' is either "0" or "1". The entities must be in the correct order for their link type (e.g. for an artist-recording relationship, the artist must be entity.0 and the recording must be entity.1). See http://musicbrainz.org/relationships for a list of relationship types and the direction of their entities.
   
; entity.''n''.type
+
; entity.''n''.url
  +
: If entity.''n'' has type "url", this string contains the actual URL to use.
: Must be one of: "artist", "label", "recording", "release", "release_group", or "work". Required.
 
   
 
; period.begin_date.year
 
; period.begin_date.year
Line 37: Line 37:
 
: Integer year/month/day, boolean ended. Optional.
 
: Integer year/month/day, boolean ended. Optional.
   
; attrs.''foo''
+
; attributes.''n''.type.gid
; attrs.''foo''.''n''
+
; attributes.''n''.text_value
  +
; attributes.''n''.credited_as
: Use the former syntax for boolean attributes (e.g. attrs.additional), and the latter for multi-valued attributes (e.g. attrs.vocal.0, attrs.vocal.1). Optional.
 
  +
; attributes.''n''.removed
  +
: If editing an existing relationship, attributes are merged with existing ones. Set the "removed" field to "1" to remove an existing attribute. The "text_value" and "credited_as" fields are only applicable to types that support them. The "attributes" field itself is optional, except when adding a relationship whose link type requires certain attributes.
   
 
== Other data ==
 
== Other data ==
Line 46: Line 48:
 
: Specify the contents of an edit note.
 
: Specify the contents of an edit note.
   
; rel-editor.as_auto_editor
+
; rel-editor.make_votable
: Boolean, specifying whether to submit the edits with auto-editor privileges.
+
: Boolean that specifies whether to make the edit votable if it'd otherwise be an auto-edit.
   
 
== Example ==
 
== Example ==
Line 53: Line 55:
   
 
{
 
{
"rel-editor.rels.0.action": "edit",
+
"rel-editor.rels.0.action": "edit",
"rel-editor.rels.0.attrs.additional": 0,
+
"rel-editor.rels.0.attributes.0.type.gid": "0a5341f8-3b1d-4f99-a0c6-26b7f4e42c7f",
"rel-editor.rels.0.attrs.translated": 0,
+
"rel-editor.rels.0.attributes.0.removed": "1",
"rel-editor.rels.0.entity.0.gid": "ba550d0e-adac-4864-b88b-407cab5e76af",
+
"rel-editor.rels.0.attributes.1.type.gid": "ed11fcb1-5a18-4e1d-b12c-633ed19c8ee1",
"rel-editor.rels.0.entity.0.type": "artist",
+
"rel-editor.rels.0.attributes.1.removed": "1",
"rel-editor.rels.0.entity.1.gid": "a8a158e3-0a0e-37e1-b5b5-9480a02d816e",
+
"rel-editor.rels.0.entity.0.gid": "ba550d0e-adac-4864-b88b-407cab5e76af",
"rel-editor.rels.0.entity.1.type": "work",
+
"rel-editor.rels.0.entity.1.gid": "a8a158e3-0a0e-37e1-b5b5-9480a02d816e",
"rel-editor.rels.0.id": 15929,
+
"rel-editor.rels.0.id": 15929,
"rel-editor.rels.0.link_type": 169,
+
"rel-editor.rels.0.link_type": 169,
"rel-editor.edit_note": "removing all of the attributes because reasons",
+
"rel-editor.edit_note": "removing all of the attributes because reasons",
"rel-editor.as_auto_editor": 0
+
"rel-editor.make_votable": 0
 
}
 
}

Latest revision as of 02:13, 25 March 2015

This page documents a list of parameters you can POST to the relationship editor to add/edit/remove relationships. The relationships don't have to be on the same release.

Requests are sent to: http://musicbrainz.org/relationship-editor

You'll receive a JSON response with a "edits" key containing an array (one for each relationship added), each containing a "message" key, whose value will either be "OK", if the edit was added, or "no changes" if it already existed. If there were errors, instead of an "edits" key, the response will contain a "error" key.

Relationships

All relationship data is prefixed with rel-editor.rels.n, where n is an integer unique to each relationship.

Boolean values are either "0" or "1".

action
Must be one of: "edit" (if changing an existing relationship), "add" (if adding a new relationship), or "remove" (if removing a relationship). Required.
id
The integer ID of the relationship. Required if action is "edit" or "remove".
link_type
The integer ID of the relationship type. Required.
entity.n.gid
The MBID of entity n in the relationship. Required unless a url is specified instead (see below).
n is either "0" or "1". The entities must be in the correct order for their link type (e.g. for an artist-recording relationship, the artist must be entity.0 and the recording must be entity.1). See http://musicbrainz.org/relationships for a list of relationship types and the direction of their entities.
entity.n.url
If entity.n has type "url", this string contains the actual URL to use.
period.begin_date.year
period.begin_date.month
period.begin_date.day
period.end_date.year
period.end_date.month
period.end_date.day
period.ended
Integer year/month/day, boolean ended. Optional.
attributes.n.type.gid
attributes.n.text_value
attributes.n.credited_as
attributes.n.removed
If editing an existing relationship, attributes are merged with existing ones. Set the "removed" field to "1" to remove an existing attribute. The "text_value" and "credited_as" fields are only applicable to types that support them. The "attributes" field itself is optional, except when adding a relationship whose link type requires certain attributes.

Other data

rel-editor.edit_note
Specify the contents of an edit note.
rel-editor.make_votable
Boolean that specifies whether to make the edit votable if it'd otherwise be an auto-edit.

Example

In JSON format; NOTE that the POST data should be in url-encoded format, instead.

{
    "rel-editor.rels.0.action":                  "edit",
    "rel-editor.rels.0.attributes.0.type.gid":   "0a5341f8-3b1d-4f99-a0c6-26b7f4e42c7f",
    "rel-editor.rels.0.attributes.0.removed":    "1",
    "rel-editor.rels.0.attributes.1.type.gid":   "ed11fcb1-5a18-4e1d-b12c-633ed19c8ee1",
    "rel-editor.rels.0.attributes.1.removed":    "1",
    "rel-editor.rels.0.entity.0.gid":            "ba550d0e-adac-4864-b88b-407cab5e76af",
    "rel-editor.rels.0.entity.1.gid":            "a8a158e3-0a0e-37e1-b5b5-9480a02d816e",
    "rel-editor.rels.0.id":                      15929,
    "rel-editor.rels.0.link_type":               169,
    "rel-editor.edit_note":                      "removing all of the attributes because reasons",
    "rel-editor.make_votable":                   0
}