User:Kuno/MBS-211

From MusicBrainz Wiki

Initial request to http://localhost:3000/ws/2/label/b4edce40-090f-4956-b82a-5d9d285da40b

{
    "country": "GB", 
    "sort_name": "Planet Mu", 
    "name": "Planet Mu", 
    "lifespan": {
        "begin": {
            "year": "2011", 
            "day": null, 
            "month": null
        }
    }, 
    "id": "b4edce40-090f-4956-b82a-5d9d285da40b"
}

Change some stuff:

{
    "country": "GB", 
    "sort_name": "Planet Mu", 
    "name": "Planet Mu", 
    "lifespan": {
        "begin": {
            "year": "1995",
            "month": "02",
            "day": "30"
        },
        "end": {
            "year": "19xx",
            "month": null,
            "day": null
        }
    }, 
    "id": "b4edce40-090f-4956-b82a-5d9d285da40b"
}

Submit that as a PUT request, something like this:

curl --digest --user kuno:byld --data-binary document.json --header 'Content-Type: application/json' --header 'Accept: application/json' --request PUT 'http://localhost:3000/ws/2/label/b4edce40-090f-4956-b82a-5d9d285da40b'

The response would be:

HTTP/1.0 400 Bad Request
Content-Type: application/json; charset=utf-8
Status: 400

{
    "lifespan": {
        "begin": {
            "errors": [
                "Not a valid date"
            ]
        }, 
        "end": {
            "year": {
                "errors": [
                    "Not an integer"
                ]
            }
        }
    }
}