Skip to content

Commit

Permalink
Added Delete List Item requests to the Lists collection
Browse files Browse the repository at this point in the history
This commit adds new requests to the Lists collection in the form
of 'Delete List Item' requests.
  • Loading branch information
stuartmccoll committed Nov 25, 2020
1 parent 427590d commit bb84299
Showing 1 changed file with 248 additions and 17 deletions.
265 changes: 248 additions & 17 deletions Microsoft SharePoint REST API.postman_collection.json
@@ -1,6 +1,6 @@
{
"info": {
"_postman_id": "c197c2c0-e2c0-44e5-a9c8-25e9dfbcbb2e",
"_postman_id": "379f08e6-35b0-4935-b9b7-6da2883e3bcf",
"name": "Microsoft SharePoint REST API",
"description": "A collection of Postman requests for the Microsoft SharePoint REST API.",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
Expand All @@ -15,7 +15,7 @@
{
"listen": "test",
"script": {
"id": "610c5826-515e-4bcf-8ee8-878d9fd5635a",
"id": "ff7f1ecc-984a-4adb-a066-a688ec6703f4",
"exec": [
"const json_response_body = JSON.parse(responseBody);",
"postman.setEnvironmentVariable(\"appReg_bearerToken\", json_response_body.access_token);"
Expand Down Expand Up @@ -83,7 +83,7 @@
{
"listen": "test",
"script": {
"id": "74b499e8-03a0-4576-8e9d-deff8fa2fe9a",
"id": "0274eafa-369e-4dcc-9548-62a3caa77ce9",
"exec": [
"// Retrieve the realm GUID from the WWW-Authenticate header",
"",
Expand Down Expand Up @@ -151,7 +151,7 @@
{
"listen": "test",
"script": {
"id": "b8c497b2-1fe9-419e-9330-cf61ea4d831e",
"id": "6117ce77-bc32-498d-b737-ea9b122efe39",
"exec": [
"const json_response_body = JSON.parse(responseBody);",
"postman.setEnvironmentVariable(\"ListItemEntityTypeFullName\", json_response_body.ListItemEntityTypeFullName);"
Expand Down Expand Up @@ -198,12 +198,12 @@
"response": []
},
{
"name": "Create New List Item",
"name": "Create New List Item (By List Title)",
"event": [
{
"listen": "prerequest",
"script": {
"id": "16b5b2e7-613b-4417-8344-7333d6c4b8f0",
"id": "54b76a93-5f54-4157-a06b-abf15220f25c",
"exec": [
"// Obtain the ListItemEntityTypeFullName before sending request",
"",
Expand Down Expand Up @@ -267,7 +267,238 @@
"items"
]
},
"description": "This request will create a new item in a given SharePoint list. Replace 'Test list' in the URL with your own SharePoint list name."
"description": "This request will create a new item in a given SharePoint list (by referencing the list's title). Replace 'Test list' in the URL with your own SharePoint list name."
},
"response": []
},
{
"name": "Create New List Item (By List GUID)",
"event": [
{
"listen": "prerequest",
"script": {
"id": "74e9fd42-1727-4a50-b6cd-3d600ac5b374",
"exec": [
"// Obtain the ListItemEntityTypeFullName before sending request",
"",
"pm.sendRequest(",
" {",
" url: \"https://\" + pm.environment.get('targetHost') + \"/_api/web/lists/GetByTitle('Test list')?$select=ListItemEntityTypeFullName\",",
" header: {",
" \"Authorization\": \"Bearer \" + pm.environment.get('appReg_bearerToken'),",
" \"Accept\": \"application/json;odata=nometadata\"",
" }",
" },",
" function (err, response) {",
" const json_response_body = response.json();",
" postman.setEnvironmentVariable(\"ListItemEntityTypeFullName\", json_response_body.ListItemEntityTypeFullName);",
" }",
");"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "Authorization",
"value": "Bearer {{appReg_bearerToken}}",
"type": "text"
},
{
"key": "Accept",
"value": "application/json;odata=verbose",
"type": "text"
},
{
"key": "Content-Type",
"value": "application/json;odata=verbose",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"__metadata\": {\n \"type\": \"{{ListItemEntityTypeFullName}}\"\n },\n \"Title\": \"Item Name\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "https://{{targetHost}}/_api/web/lists(guid'{list_guid}')/items",
"protocol": "https",
"host": [
"{{targetHost}}"
],
"path": [
"_api",
"web",
"lists(guid'{list_guid}')",
"items"
]
},
"description": "This request will create a new item in a given SharePoint list using the specified list's GUID. Replace \"{list_guid}\" in the URL with your own SharePoint list GUID."
},
"response": []
},
{
"name": "Delete List Item (By List GUID)",
"event": [
{
"listen": "prerequest",
"script": {
"id": "cc441ddf-eb1a-42ed-a3dd-c0302378bd52",
"exec": [
"// Obtain the ListItemEntityTypeFullName before sending request",
"",
"pm.sendRequest(",
" {",
" url: \"https://\" + pm.environment.get('targetHost') + \"/_api/web/lists/GetByTitle('Test list')?$select=ListItemEntityTypeFullName\",",
" header: {",
" \"Authorization\": \"Bearer \" + pm.environment.get('appReg_bearerToken'),",
" \"Accept\": \"application/json;odata=nometadata\"",
" }",
" },",
" function (err, response) {",
" const json_response_body = response.json();",
" postman.setEnvironmentVariable(\"ListItemEntityTypeFullName\", json_response_body.ListItemEntityTypeFullName);",
" }",
");"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "Authorization",
"type": "text",
"value": "Bearer {{appReg_bearerToken}}"
},
{
"key": "Accept",
"type": "text",
"value": "application/json;odata=verbose"
},
{
"key": "Content-Type",
"type": "text",
"value": "application/json;odata=verbose"
},
{
"key": "If-Match",
"value": "*",
"type": "text"
},
{
"key": "X-HTTP-Method",
"value": "DELETE",
"type": "text"
}
],
"url": {
"raw": "https://{{targetHost}}/_api/web/lists(guid'{list_guid}')/items({item_id})",
"protocol": "https",
"host": [
"{{targetHost}}"
],
"path": [
"_api",
"web",
"lists(guid'{list_guid}')",
"items({item_id})"
]
},
"description": "This request will delete a specified item in a given SharePoint list using the specified list's GUID and the specified item's ID. Replace \"{list_guid}\" in the URL with your own SharePoint list GUID, and \"{item_id}\" with your own item ID."
},
"response": []
},
{
"name": "Delete List Item (By List Title)",
"event": [
{
"listen": "prerequest",
"script": {
"id": "d2bc60c8-e614-4a99-9ef8-18cd13139f71",
"exec": [
"// Obtain the ListItemEntityTypeFullName before sending request",
"",
"pm.sendRequest(",
" {",
" url: \"https://\" + pm.environment.get('targetHost') + \"/_api/web/lists/GetByTitle('Test list')?$select=ListItemEntityTypeFullName\",",
" header: {",
" \"Authorization\": \"Bearer \" + pm.environment.get('appReg_bearerToken'),",
" \"Accept\": \"application/json;odata=nometadata\"",
" }",
" },",
" function (err, response) {",
" const json_response_body = response.json();",
" postman.setEnvironmentVariable(\"ListItemEntityTypeFullName\", json_response_body.ListItemEntityTypeFullName);",
" }",
");"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "Authorization",
"type": "text",
"value": "Bearer {{appReg_bearerToken}}"
},
{
"key": "Accept",
"type": "text",
"value": "application/json;odata=verbose"
},
{
"key": "Content-Type",
"type": "text",
"value": "application/json;odata=verbose"
},
{
"key": "If-Match",
"value": "*",
"type": "text"
},
{
"key": "X-HTTP-Method",
"value": "DELETE",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"__metadata\": {\n \"type\": \"{{ListItemEntityTypeFullName}}\"\n }\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "https://{{targetHost}}/_api/web/lists/GetByTitle('{list_title}')/items({item_id})",
"protocol": "https",
"host": [
"{{targetHost}}"
],
"path": [
"_api",
"web",
"lists",
"GetByTitle('{list_title}')",
"items({item_id})"
]
},
"description": "This request will delete a specified item in a given SharePoint list using the specified list's GUID and the specified item's ID. Replace \"{list_guid}\" in the URL with your own SharePoint list GUID, and \"{item_id}\" with your own item ID."
},
"response": []
},
Expand All @@ -277,7 +508,7 @@
{
"listen": "prerequest",
"script": {
"id": "4cdec1bc-a80e-4bdb-87e3-a9271fd60778",
"id": "692e304a-d460-4f92-9b91-e6cd4d5aed53",
"exec": [
""
],
Expand Down Expand Up @@ -335,7 +566,7 @@
{
"listen": "prerequest",
"script": {
"id": "9fc9108c-38c4-4794-baab-162b282d4df0",
"id": "d54e6362-d335-4983-a73b-8c4e2986e3d8",
"exec": [
""
],
Expand Down Expand Up @@ -394,7 +625,7 @@
{
"listen": "prerequest",
"script": {
"id": "4621339e-180c-4b3a-bc84-419e27bc4ccc",
"id": "cbeb4a39-0b03-4862-8825-7144b33a10fc",
"exec": [
""
],
Expand Down Expand Up @@ -432,7 +663,7 @@
}
],
"url": {
"raw": "https://{{targetHost}}/_api/web/lists/GetByTitle('{list_title')",
"raw": "https://{{targetHost}}/_api/web/lists/GetByTitle('{list_title}')",
"protocol": "https",
"host": [
"{{targetHost}}"
Expand All @@ -441,7 +672,7 @@
"_api",
"web",
"lists",
"GetByTitle('{list_title')"
"GetByTitle('{list_title}')"
]
},
"description": "This request will delete a SharePoint list based on the title specified in the URI. Replace the \"{list_title}\" value in the URI with your chosen SharePoint list title."
Expand All @@ -454,7 +685,7 @@
{
"listen": "prerequest",
"script": {
"id": "af4c65b5-40e5-4618-bfa1-3845d12f12a3",
"id": "805f5de2-579b-411b-ab7b-43d5b48edaae",
"exec": [
"// Obtain the ListItemEntityTypeFullName before sending request",
"",
Expand Down Expand Up @@ -567,15 +798,15 @@
}
],
"url": {
"raw": "https://{{targetHost}}/_api/web/lists(guid'{list_guid')",
"raw": "https://{{targetHost}}/_api/web/lists(guid'{list_guid}')",
"protocol": "https",
"host": [
"{{targetHost}}"
],
"path": [
"_api",
"web",
"lists(guid'{list_guid')"
"lists(guid'{list_guid}')"
]
},
"description": "This request will retrieve a SharePoint list using the specified list GUID. Replace \"{list_guid}\" with your own SharePoint list GUID."
Expand Down Expand Up @@ -623,7 +854,7 @@
{
"listen": "prerequest",
"script": {
"id": "c8e5ce96-0857-4b1c-99a4-255e17c9f28d",
"id": "3b0c59ac-205c-4ffe-991d-5924a9721236",
"type": "text/javascript",
"exec": [
""
Expand All @@ -633,7 +864,7 @@
{
"listen": "test",
"script": {
"id": "bcbdc8dc-5d2e-4241-9c6b-0d48d4340898",
"id": "bddbba1c-0923-43cc-8569-e529ebe68fbe",
"type": "text/javascript",
"exec": [
""
Expand Down

0 comments on commit bb84299

Please sign in to comment.