Description | Original Server State | PATCH payload | Server state after PATCH operation | Response Code |
---|
Replacing a leaf node | { "categories": { "code": "1", "name": "Children", "books": [ { "title": "Matilda", "lang": "English", "price": 200, "editions": [1988,2000] } ] } } | { "categories": { "code": "1", "name": "Kids", "books": [ { "title": "Matilda", "lang": "English", "price": 200, "editions": [1988,2000] } ] } } | { "categories": { "code": "1", "name": "Kids", "books": [ { "title": "Matilda", "lang": "English", "price": 200, "editions": [1988,2000] } ] } } | 200 OK |
Replacing a leaf node and entire list | { "categories": { "code": "1", "name": "Children", "books": [ { "title": "Matilda", "lang": "English", "price": 200, "editions": [1988,2000] } ] } } | { "categories": { "code": "1", "name": "Kids" } } | { "categories": { "code": "1", "name": "Kids" ] } } | 200 OK |
Using PUT to create a new list | { "categories": { "code": "1", "name": "Children" } } | { "categories": { "code": "1", "name": "Kids", "books": [ { "title": "Matilda", "lang": "English", "price": 200, "editions": [1988,2000] } ] } } | { "categories": { "code": "1", "name": "Kids", "books": [ { "title": "Matilda", "lang": "English", "price": 200, "editions": [1988,2000] } ] } } | 201 Created |
Using PUT to add a new list item | { "categories": { "code": "1", "name": "Children", "books": [ { "title": "Matilda", "lang": "English", "price": 200, "editions": [1988,2000] } ] } } | { "categories": { "code": "1", "name": "Children", "books": [ { "title": "Matilda", "lang": "English", "price": 200, "editions": [1988,2000] }, { "title": "The Gruffalo", "lang": "English", "authors": ["Julia"], "editions": [1999], "price": 15 } ] } } | { "categories": { "code": "1", "name": "Children", "books": [ { "title": "Matilda", "lang": "English", "price": 200, "editions": [1988,2000] }, { "title": "The Gruffalo", "lang": "English", "authors": ["Julia"], "editions": [1999], "price": 15 } ] } } | 201 Created |
Replacing an entire list with a new list item | { "categories": { "code": "1", "name": "Children", "books": [ { "title": "Matilda", "lang": "English", "price": 200, "editions": [1988,2000] }, { "title": "The Gruffalo", "lang": "English", "authors": ["Julia"], "editions": [1999], "price": 15 } ] } } | { "categories": { "code": "1", "books": [ { "title": "New Book", "lang": "English", "price": 0, "editions": [2025] } ] } } | { "categories": { "code": "1", "books": [ { "title": "New Book", "lang": "English", "price": 0, "editions": [2025] } ] } } | 200 OK |
Replacing entire leaf list using PUT | { "categories": { "code": "1", "name": "Children", "books": [ { "title": "Matilda", "lang": "English", "price": 200, "editions": [1988,2000] } ] } } | { "categories": { "code": "1", "name": "Children", "books": [ { "title": "Matilda", "lang": "English", "price": 200, "editions": [2025] } ] } } | { "categories": { "code": "1", "name": "Children", "books": [ { "title": "Matilda", "lang": "English", "price": 200, "editions": [2025] } ] } } | 200 OK |