User:Kuno/MBS-211

From MusicBrainz Wiki
< User:Kuno
Revision as of 23:43, 8 September 2012 by Ianmcorvidae (talk | contribs) (Ianmcorvidae moved page User:Kuno/mbs-211 to User:Kuno/MBS-211)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

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"
                ]
            }
        }
    }
}