IBM Cloud Docs
Utilizzo Postman

Utilizzo Postman

Di seguito troverai la configurazione di base di Postman per l'API REST IBM Cloud® Object Storage. Puoi trovare ulteriori dettagli nella guida di riferimento API per i bucket o gli oggetti.

L'utilizzo di Postman presuppone una certa familiarità con Object Storage e le informazioni necessarie da una credenziale del servizio o dalla console, come mostrato nell'introduzione a IBM Cloud Object Storage. Se alcuni termini o variabili non sono familiari, possono essere trovati nella FAQ.

PII (Personally Identifiable Information): quando denominare bucket o oggetti, non utilizzare alcuna informazione che possa identificare un utente (persona fisica) per nome, posizione o qualsiasi altro mezzo.

Panoramica del cliente API REST

L'interazione con un'API REST non è così semplice come utilizzare un browser internet standard. I browser semplici non consentono manipolazioni della richiesta URL. Un client API REST può aiutare a mettere rapidamente insieme le richieste HTTP semplici e quelle complesse.

Prerequisiti

Crea un bucket

  1. Avvia Postman
  2. Nella scheda New, seleziona PUT.
  3. Immetti l'endpoint nella barra degli indirizzi e aggiungi il nome del tuo nuovo bucket. a. I nomi bucket devono essere univoci in tutti i bucket, quindi scegli qualcosa di specifico.
  4. Nel menu Type, seleziona Bearer Token.
  5. Aggiungi il token IAM nella casella Token.
  6. Fai clic su Preview Request. a. Dovresti vedere un messaggio di conferma indicante che le intestazioni sono state aggiunte.
  7. Fai clic sulla scheda Header dove dovresti vedere una voce esistente per l'autorizzazione.
  8. Aggiungi una chiave. a. Chiave: ibm-service-instance-id b. Valore: ID istanza della risorsa per il tuo servizio di archiviazione cloud.
  9. Fai clic su Send.
  10. Riceverai un messaggio di stato 200 OK.

Crea un oggetto file di testo

  1. Crea una scheda facendo clic sull'icona Più (+).
  2. Seleziona PUT dall'elenco.
  3. Nella barra degli indirizzi, immetti l'indirizzo dell'endpoint con il nome bucket proveniente dalla sezione precedente e un nome file.
  4. Nell'elenco Type, seleziona Bearer Token.
  5. Aggiungi il token IAM nella casella Token.
  6. Seleziona la scheda Body.
  7. Seleziona un'opzione non elaborata e assicurati che sia selezionato Text.
  8. Immetti il testo nello spazio fornito.
  9. Fai clic su Send.
  10. Ricevi un messaggio di stato 200 OK.

Elenca il contenuto di un bucket

  1. Crea una nuova scheda selezionando l'icona Più (+).
  2. Verifica che GET sia selezionato nell'elenco.
  3. Nella barra degli indirizzi, immetti l'indirizzo dell'endpoint con il nome bucket proveniente dalla sezione precedente.
  4. Nell'elenco Type, seleziona Bearer Token.
  5. Aggiungi il token IAM nella casella Token.
  6. Fai clic su Send.
  7. Ricevi un messaggio di stato 200 OK.
  8. Nella sezione del corpo della risposta è presente un messaggio XML con l'elenco dei file nel tuo bucket.

Utilizzo della raccolta di esempio

Questa collezione Postman è fornita come punto di partenza per sperimentare con l'API e non è destinata all'uso in produzione:

{
	"info": {
		"_postman_id": "56d99641-9ad6-4218-b3d4-18ac8f3361e0",
		"name": "IBM COS",
		"description": "IBM COS samples",
		"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
	},
	"item": [
		{
			"name": "Retrieve list of buckets",
			"event": [
				{
					"listen": "test",
					"script": {
						"id": "d67afcf2-6d35-4a2a-9542-b8d5df78eded",
						"type": "text/javascript",
						"exec": [
							"pm.test(\"Request was successful\", function() {",
							"   pm.response.to.be.success; ",
							"});",
							"",
							"pm.test(\"Response contains expected content\", function() {",
							"    pm.expect(pm.response.text()).to.include(\"ListAllMyBucketsResult\");",
							"});"
						]
					}
				}
			],
			"request": {
				"auth": {
					"type": "bearer",
					"bearer": [
						{
							"key": "token",
							"value": "{{iamtoken}}",
							"type": "string"
						}
					]
				},
				"method": "GET",
				"header": [
					{
						"key": "ibm-service-instance-id",
						"value": "{{serviceid}}"
					}
				],
				"body": {},
				"url": {
					"raw": "https://{{endpoint-region}}cloud-object-storage.appdomain.cloud",
					"protocol": "https",
					"host": [
						"{{endpoint-region}}",
						"objectstorage",
						"softlayer",
						"net"
					]
				}
			},
			"response": []
		},
		{
			"name": "Create new bucket",
			"event": [
				{
					"listen": "test",
					"script": {
						"id": "3cebb9d7-90ee-42c0-9154-b26bd229e179",
						"type": "text/javascript",
						"exec": [
							"pm.test(\"Request was successful\", function() {",
							"   pm.response.to.be.success; ",
							"});"
						]
					}
				}
			],
			"request": {
				"auth": {
					"type": "bearer",
					"bearer": [
						{
							"key": "token",
							"value": "{{iamtoken}}",
							"type": "string"
						}
					]
				},
				"method": "PUT",
				"header": [
					{
						"key": "ibm-service-instance-id",
						"value": "{{serviceid}}"
					}
				],
				"body": {
					"mode": "raw",
					"raw": ""
				},
				"url": {
					"raw": "https://{{endpoint-region}}cloud-object-storage.appdomain.cloud/{{bucket}}",
					"protocol": "https",
					"host": [
						"{{endpoint-region}}",
						"objectstorage",
						"softlayer",
						"net"
					],
					"path": [
						"{{bucket}}"
					]
				},
				"description": "Create new bucket"
			},
			"response": []
		},
		{
			"name": "Create new text file",
			"event": [
				{
					"listen": "test",
					"script": {
						"id": "0a54c09b-0032-4933-ae99-81911935cb4d",
						"type": "text/javascript",
						"exec": [
							"pm.test(\"Request was successful\", function() {",
							"   pm.response.to.be.success; ",
							"});",
							"",
							"pm.test(\"Response contains expected header\", function() {",
							"    pm.response.to.have.header(\"ETag\");",
							"});"
						]
					}
				}
			],
			"request": {
				"auth": {
					"type": "bearer",
					"bearer": [
						{
							"key": "token",
							"value": "{{iamtoken}}",
							"type": "string"
						}
					]
				},
				"method": "PUT",
				"header": [
					{
						"key": "Content-Type",
						"value": "application/x-www-form-urlencoded"
					}
				],
				"body": {
					"mode": "raw",
					"raw": "This is test data for the text file."
				},
				"url": {
					"raw": "https://{{endpoint-region}}cloud-object-storage.appdomain.cloud/{{bucket}}/testfile.txt",
					"protocol": "https",
					"host": [
						"{{endpoint-region}}",
						"objectstorage",
						"softlayer",
						"net"
					],
					"path": [
						"{{bucket}}",
						"testfile.txt"
					]
				},
				"description": "Create a new text file in the bucket"
			},
			"response": []
		},
		{
			"name": "Create new binary file",
			"event": [
				{
					"listen": "test",
					"script": {
						"id": "80e3e8bd-3fb5-4874-a638-510cf5b8c872",
						"type": "text/javascript",
						"exec": [
							"pm.test(\"Request was successful\", function() {",
							"   pm.response.to.be.success; ",
							"});",
							"",
							"pm.test(\"Response contains expected header\", function() {",
							"    pm.response.to.have.header(\"ETag\");",
							"});"
						]
					}
				}
			],
			"request": {
				"auth": {
					"type": "bearer",
					"bearer": [
						{
							"key": "token",
							"value": "{{iamtoken}}",
							"type": "string"
						}
					]
				},
				"method": "PUT",
				"header": [
					{
						"key": "Content-Type",
						"value": "image/jpeg"
					}
				],
				"body": {
					"mode": "file",
					"file": {}
				},
				"url": {
					"raw": "https://{{endpoint-region}}cloud-object-storage.appdomain.cloud/{{bucket}}/testimage.jpg",
					"protocol": "https",
					"host": [
						"{{endpoint-region}}",
						"objectstorage",
						"softlayer",
						"net"
					],
					"path": [
						"{{bucket}}",
						"testimage.jpg"
					]
				},
				"description": "Create a new binary (image) file in the bucket"
			},
			"response": []
		},
		{
			"name": "Retrieve list of files from bucket",
			"event": [
				{
					"listen": "test",
					"script": {
						"id": "aae11dfd-89e5-464d-a6da-44c05652ccec",
						"type": "text/javascript",
						"exec": [
							"pm.test(\"Request was successful\", function() {",
							"   pm.response.to.be.success; ",
							"});",
							"",
							"pm.test(\"Response contains expected content\", function() {",
							"    pm.expect(pm.response.text()).to.include(\"ListBucketResult\");",
							"});"
						]
					}
				}
			],
			"request": {
				"auth": {
					"type": "bearer",
					"bearer": [
						{
							"key": "token",
							"value": "{{iamtoken}}",
							"type": "string"
						}
					]
				},
				"method": "GET",
				"header": [],
				"body": {
					"mode": "raw",
					"raw": ""
				},
				"url": {
					"raw": "https://{{endpoint-region}}cloud-object-storage.appdomain.cloud/{{bucket}}",
					"protocol": "https",
					"host": [
						"{{endpoint-region}}",
						"objectstorage",
						"softlayer",
						"net"
					],
					"path": [
						"{{bucket}}"
					]
				},
				"description": "Retrieve the list of files available in the bucket"
			},
			"response": []
		},
		{
			"name": "Retrieve list of files from bucket (filter by prefix)",
			"event": [
				{
					"listen": "test",
					"script": {
						"id": "aae11dfd-89e5-464d-a6da-44c05652ccec",
						"type": "text/javascript",
						"exec": [
							"pm.test(\"Request was successful\", function() {",
							"   pm.response.to.be.success; ",
							"});",
							"",
							"pm.test(\"Response contains expected content\", function() {",
							"    pm.expect(pm.response.text()).to.include(\"ListBucketResult\");",
							"});"
						]
					}
				}
			],
			"request": {
				"auth": {
					"type": "bearer",
					"bearer": [
						{
							"key": "token",
							"value": "{{iamtoken}}",
							"type": "string"
						}
					]
				},
				"method": "GET",
				"header": [],
				"body": {
					"mode": "raw",
					"raw": ""
				},
				"url": {
					"raw": "https://{{endpoint-region}}cloud-object-storage.appdomain.cloud/{{bucket}}?prefix=new",
					"protocol": "https",
					"host": [
						"{{endpoint-region}}",
						"objectstorage",
						"softlayer",
						"net"
					],
					"path": [
						"{{bucket}}"
					],
					"query": [
						{
							"key": "prefix",
							"value": "new"
						}
					]
				},
				"description": "Retrieve the list of files available in the bucket"
			},
			"response": []
		},
		{
			"name": "Retrieve text file",
			"event": [
				{
					"listen": "test",
					"script": {
						"id": "58817cc7-7d15-45a9-b372-7712d2fd389d",
						"type": "text/javascript",
						"exec": [
							"pm.test(\"Request was successful\", function() {",
							"   pm.response.to.be.success; ",
							"});",
							"",
							"pm.test(\"Response contains expected body content\", function() {",
							"    pm.expect(pm.response.text()).to.include(\"This is test data\");",
							"});",
							"",
							"pm.test(\"Response contains expected header\", function() {",
							"    pm.response.to.have.header(\"ETag\");",
							"});"
						]
					}
				}
			],
			"request": {
				"auth": {
					"type": "bearer",
					"bearer": [
						{
							"key": "token",
							"value": "{{iamtoken}}",
							"type": "string"
						}
					]
				},
				"method": "GET",
				"header": [],
				"body": {
					"mode": "raw",
					"raw": ""
				},
				"url": {
					"raw": "https://{{endpoint-region}}cloud-object-storage.appdomain.cloud/{{bucket}}/testfile.txt",
					"protocol": "https",
					"host": [
						"{{endpoint-region}}",
						"objectstorage",
						"softlayer",
						"net"
					],
					"path": [
						"{{bucket}}",
						"testfile.txt"
					]
				},
				"description": "Retrieving a file from bucket"
			},
			"response": []
		},
		{
			"name": "Retrieve binary file",
			"event": [
				{
					"listen": "test",
					"script": {
						"id": "db6fa324-080a-43bc-a301-32e70d9bbd65",
						"type": "text/javascript",
						"exec": [
							"pm.test(\"Request was successful\", function() {",
							"   pm.response.to.be.success; ",
							"});",
							"",
							"pm.test(\"Response contains expected header\", function() {",
							"    pm.response.to.have.header(\"ETag\");",
							"});"
						]
					}
				}
			],
			"request": {
				"auth": {
					"type": "bearer",
					"bearer": [
						{
							"key": "token",
							"value": "{{iamtoken}}",
							"type": "string"
						}
					]
				},
				"method": "GET",
				"header": [],
				"body": {
					"mode": "raw",
					"raw": ""
				},
				"url": {
					"raw": "https://{{endpoint-region}}cloud-object-storage.appdomain.cloud/{{bucket}}/testimage.jpg",
					"protocol": "https",
					"host": [
						"{{endpoint-region}}",
						"objectstorage",
						"softlayer",
						"net"
					],
					"path": [
						"{{bucket}}",
						"testimage.jpg"
					]
				},
				"description": "Retrieve a binary file from the bucket"
			},
			"response": []
		},
		{
			"name": "Retrieve list of failed multipart uploads",
			"event": [
				{
					"listen": "test",
					"script": {
						"id": "835bcaf6-6e7d-4fa9-883e-1a5c5538ac7e",
						"type": "text/javascript",
						"exec": [
							"pm.test(\"Request was successful\", function() {",
							"   pm.response.to.be.success; ",
							"});",
							"",
							"pm.test(\"Response contains expected content\", function() {",
							"    pm.expect(pm.response.text()).to.include(\"ListMultipartUploadsResult\");",
							"});"
						]
					}
				}
			],
			"request": {
				"auth": {
					"type": "bearer",
					"bearer": [
						{
							"key": "token",
							"value": "{{iamtoken}}",
							"type": "string"
						}
					]
				},
				"method": "GET",
				"header": [],
				"body": {
					"mode": "raw",
					"raw": ""
				},
				"url": {
					"raw": "https://{{endpoint-region}}cloud-object-storage.appdomain.cloud/{{bucket}}?uploads=",
					"protocol": "https",
					"host": [
						"{{endpoint-region}}",
						"objectstorage",
						"softlayer",
						"net"
					],
					"path": [
						"{{bucket}}"
					],
					"query": [
						{
							"key": "uploads",
							"value": ""
						}
					]
				},
				"description": "Retrieve the list of files available in the bucket"
			},
			"response": []
		},
		{
			"name": "Retrieve list of failed multipart uploads (filter by name)",
			"event": [
				{
					"listen": "test",
					"script": {
						"id": "835bcaf6-6e7d-4fa9-883e-1a5c5538ac7e",
						"type": "text/javascript",
						"exec": [
							"pm.test(\"Request was successful\", function() {",
							"   pm.response.to.be.success; ",
							"});",
							"",
							"pm.test(\"Response contains expected content\", function() {",
							"    pm.expect(pm.response.text()).to.include(\"ListMultipartUploadsResult\");",
							"});"
						]
					}
				}
			],
			"request": {
				"auth": {
					"type": "bearer",
					"bearer": [
						{
							"key": "token",
							"value": "{{iamtoken}}",
							"type": "string"
						}
					]
				},
				"method": "GET",
				"header": [],
				"body": {
					"mode": "raw",
					"raw": ""
				},
				"url": {
					"raw": "https://{{endpoint-region}}cloud-object-storage.appdomain.cloud/{{bucket}}?uploads=&prefix=my",
					"protocol": "https",
					"host": [
						"{{endpoint-region}}",
						"objectstorage",
						"softlayer",
						"net"
					],
					"path": [
						"{{bucket}}"
					],
					"query": [
						{
							"key": "uploads",
							"value": ""
						},
						{
							"key": "prefix",
							"value": "my"
						}
					]
				},
				"description": "Retrieve the list of files available in the bucket"
			},
			"response": []
		},
		{
			"name": "Set CORS enabled bucket",
			"event": [
				{
					"listen": "test",
					"script": {
						"id": "5cf3d531-13f1-4cf6-a4fc-2f8d2d8e48af",
						"type": "text/javascript",
						"exec": [
							"pm.test(\"Request was successful\", function() {",
							"   pm.response.to.be.success; ",
							"});"
						]
					}
				}
			],
			"request": {
				"auth": {
					"type": "bearer",
					"bearer": [
						{
							"key": "token",
							"value": "{{iamtoken}}",
							"type": "string"
						}
					]
				},
				"method": "PUT",
				"header": [
					{
						"key": "ibm-service-instance-id",
						"value": "{{serviceid}}"
					},
					{
						"key": "Content-MD5",
						"value": "GQmpTNpruOyK6YrxHnpj7g=="
					}
				],
				"body": {
					"mode": "raw",
					"raw": "<CORSConfiguration>\n  <CORSRule>\n    <AllowedOrigin>http:www.ibm.com</AllowedOrigin>\n    <AllowedMethod>GET</AllowedMethod>\n    <AllowedMethod>PUT</AllowedMethod>\n    <AllowedMethod>POST</AllowedMethod>\n  </CORSRule>\n</CORSConfiguration>"
				},
				"url": {
					"raw": "https://{{endpoint-region}}cloud-object-storage.appdomain.cloud/{{bucket}}?cors=",
					"protocol": "https",
					"host": [
						"{{endpoint-region}}",
						"objectstorage",
						"softlayer",
						"net"
					],
					"path": [
						"{{bucket}}"
					],
					"query": [
						{
							"key": "cors",
							"value": ""
						}
					]
				}
			},
			"response": []
		},
		{
			"name": "Retrieve bucket CORS config",
			"event": [
				{
					"listen": "test",
					"script": {
						"id": "d9c0dce3-decd-4f3e-b5b1-e3f4a89f1283",
						"type": "text/javascript",
						"exec": [
							"pm.test(\"Request was successful\", function() {",
							"   pm.response.to.be.success; ",
							"});",
							"",
							"pm.test(\"Response contains expected content\", function() {",
							"    pm.expect(pm.response.text()).to.include(\"CORSConfiguration\");",
							"});"
						]
					}
				}
			],
			"request": {
				"auth": {
					"type": "bearer",
					"bearer": [
						{
							"key": "token",
							"value": "{{iamtoken}}",
							"type": "string"
						}
					]
				},
				"method": "GET",
				"header": [],
				"body": {
					"mode": "raw",
					"raw": ""
				},
				"url": {
					"raw": "https://{{endpoint-region}}cloud-object-storage.appdomain.cloud/{{bucket}}?cors=",
					"protocol": "https",
					"host": [
						"{{endpoint-region}}",
						"objectstorage",
						"softlayer",
						"net"
					],
					"path": [
						"{{bucket}}"
					],
					"query": [
						{
							"key": "cors",
							"value": ""
						}
					]
				},
				"description": "Retrieve the list of files available in the bucket"
			},
			"response": []
		},
		{
			"name": "Delete bucket CORS config",
			"event": [
				{
					"listen": "test",
					"script": {
						"id": "83ce0bed-572f-4c16-b45f-67a7a9cc5550",
						"type": "text/javascript",
						"exec": [
							"pm.test(\"Request was successful\", function() {",
							"   pm.response.to.be.success; ",
							"});"
						]
					}
				}
			],
			"request": {
				"auth": {
					"type": "bearer",
					"bearer": [
						{
							"key": "token",
							"value": "{{iamtoken}}",
							"type": "string"
						}
					]
				},
				"method": "DELETE",
				"header": [],
				"body": {
					"mode": "raw",
					"raw": ""
				},
				"url": {
					"raw": "https://{{endpoint-region}}cloud-object-storage.appdomain.cloud/{{bucket}}?cors=",
					"protocol": "https",
					"host": [
						"{{endpoint-region}}",
						"objectstorage",
						"softlayer",
						"net"
					],
					"path": [
						"{{bucket}}"
					],
					"query": [
						{
							"key": "cors",
							"value": ""
						}
					]
				},
				"description": "Retrieve the list of files available in the bucket"
			},
			"response": []
		},
		{
			"name": "Delete text file",
			"event": [
				{
					"listen": "test",
					"script": {
						"id": "78b76a84-9562-4692-9634-e10912574a89",
						"type": "text/javascript",
						"exec": [
							"pm.test(\"Request was successful\", function() {",
							"   pm.response.to.be.success; ",
							"});",
							""
						]
					}
				}
			],
			"request": {
				"auth": {
					"type": "bearer",
					"bearer": [
						{
							"key": "token",
							"value": "{{iamtoken}}",
							"type": "string"
						}
					]
				},
				"method": "DELETE",
				"header": [],
				"body": {
					"mode": "raw",
					"raw": ""
				},
				"url": {
					"raw": "https://{{endpoint-region}}cloud-object-storage.appdomain.cloud/{{bucket}}/testfile.txt",
					"protocol": "https",
					"host": [
						"{{endpoint-region}}",
						"objectstorage",
						"softlayer",
						"net"
					],
					"path": [
						"{{bucket}}",
						"testfile.txt"
					]
				},
				"description": "Retrieving a file from bucket"
			},
			"response": []
		},
		{
			"name": "Delete binary file",
			"event": [
				{
					"listen": "test",
					"script": {
						"id": "a8363887-2b04-4deb-a75b-10220d30e856",
						"type": "text/javascript",
						"exec": [
							"pm.test(\"Request was successful\", function() {",
							"   pm.response.to.be.success; ",
							"});"
						]
					}
				}
			],
			"request": {
				"auth": {
					"type": "bearer",
					"bearer": [
						{
							"key": "token",
							"value": "{{iamtoken}}",
							"type": "string"
						}
					]
				},
				"method": "DELETE",
				"header": [],
				"body": {
					"mode": "raw",
					"raw": ""
				},
				"url": {
					"raw": "https://{{endpoint-region}}cloud-object-storage.appdomain.cloud/{{bucket}}/testimage.jpg",
					"protocol": "https",
					"host": [
						"{{endpoint-region}}",
						"objectstorage",
						"softlayer",
						"net"
					],
					"path": [
						"{{bucket}}",
						"testimage.jpg"
					]
				},
				"description": "Retrieve a binary file from the bucket"
			},
			"response": []
		},
		{
			"name": "Delete bucket",
			"event": [
				{
					"listen": "test",
					"script": {
						"id": "3cebb9d7-90ee-42c0-9154-b26bd229e179",
						"type": "text/javascript",
						"exec": [
							"pm.test(\"Request was successful\", function() {",
							"   pm.response.to.be.success; ",
							"});"
						]
					}
				}
			],
			"request": {
				"auth": {
					"type": "bearer",
					"bearer": [
						{
							"key": "token",
							"value": "{{iamtoken}}",
							"type": "string"
						}
					]
				},
				"method": "DELETE",
				"header": [
					{
						"key": "ibm-service-instance-id",
						"value": "{{serviceid}}"
					}
				],
				"body": {
					"mode": "raw",
					"raw": ""
				},
				"url": {
					"raw": "https://{{endpoint-region}}cloud-object-storage.appdomain.cloud/{{bucket}}",
					"protocol": "https",
					"host": [
						"{{endpoint-region}}",
						"objectstorage",
						"softlayer",
						"net"
					],
					"path": [
						"{{bucket}}"
					]
				},
				"description": "Create new bucket"
			},
			"response": []
		},
		{
			"name": "Create new bucket (different storage class)",
			"event": [
				{
					"listen": "test",
					"script": {
						"id": "5cf3d531-13f1-4cf6-a4fc-2f8d2d8e48af",
						"type": "text/javascript",
						"exec": [
							"pm.test(\"Request was successful\", function() {",
							"   pm.response.to.be.success; ",
							"});"
						]
					}
				}
			],
			"request": {
				"auth": {
					"type": "bearer",
					"bearer": [
						{
							"key": "token",
							"value": "{{iamtoken}}",
							"type": "string"
						}
					]
				},
				"method": "PUT",
				"header": [
					{
						"key": "ibm-service-instance-id",
						"value": "{{serviceid}}"
					},
					{
						"key": "Content-Type",
						"value": "application/x-www-form-urlencoded"
					}
				],
				"body": {
					"mode": "raw",
					"raw": "<CreateBucketConfiguration>\n\t<LocationConstraint>{{bucketlocationvault}}</LocationConstraint>\n</CreateBucketConfiguration>"
				},
				"url": {
					"raw": "https://{{endpoint-region}}cloud-object-storage.appdomain.cloud/{{bucket}}vault",
					"protocol": "https",
					"host": [
						"{{endpoint-region}}",
						"objectstorage",
						"softlayer",
						"net"
					],
					"path": [
						"{{bucket}}vault"
					]
				}
			},
			"response": []
		},
		{
			"name": "Delete bucket (different storage class)",
			"event": [
				{
					"listen": "test",
					"script": {
						"id": "5cf3d531-13f1-4cf6-a4fc-2f8d2d8e48af",
						"type": "text/javascript",
						"exec": [
							"pm.test(\"Request was successful\", function() {",
							"   pm.response.to.be.success; ",
							"});"
						]
					}
				}
			],
			"request": {
				"auth": {
					"type": "bearer",
					"bearer": [
						{
							"key": "token",
							"value": "{{iamtoken}}",
							"type": "string"
						}
					]
				},
				"method": "DELETE",
				"header": [
					{
						"key": "ibm-service-instance-id",
						"value": "{{serviceid}}"
					}
				],
				"body": {
					"mode": "raw",
					"raw": ""
				},
				"url": {
					"raw": "https://{{endpoint-region}}cloud-object-storage.appdomain.cloud/{{bucket}}vault",
					"protocol": "https",
					"host": [
						"{{endpoint-region}}",
						"objectstorage",
						"softlayer",
						"net"
					],
					"path": [
						"{{bucket}}vault"
					]
				}
			},
			"response": []
		},
		{
			"name": "Create new bucket (key protect)",
			"event": [
				{
					"listen": "test",
					"script": {
						"id": "5cf3d531-13f1-4cf6-a4fc-2f8d2d8e48af",
						"type": "text/javascript",
						"exec": [
							"pm.test(\"Request was successful\", function() {",
							"   pm.response.to.be.success; ",
							"});"
						]
					}
				}
			],
			"request": {
				"auth": {
					"type": "bearer",
					"bearer": [
						{
							"key": "token",
							"value": "{{iamtoken}}",
							"type": "string"
						}
					]
				},
				"method": "PUT",
				"header": [
					{
						"key": "ibm-service-instance-id",
						"value": "{{serviceid}}"
					},
					{
						"key": "ibm-sse-kp-encryption-algorithm",
						"value": "AES256"
					},
					{
						"key": "ibm-sse-kp-customer-root-key-crn",
						"value": "{{rootkeycrn}}"
					}
				],
				"body": {
					"mode": "raw",
					"raw": ""
				},
				"url": {
					"raw": "https://{{endpoint-region}}cloud-object-storage.appdomain.cloud/{{bucket}}kp",
					"protocol": "https",
					"host": [
						"{{endpoint-region}}",
						"objectstorage",
						"softlayer",
						"net"
					],
					"path": [
						"{{bucket}}kp"
					]
				}
			},
			"response": []
		},
		{
			"name": "Delete bucket (key protect)",
			"event": [
				{
					"listen": "test",
					"script": {
						"id": "5cf3d531-13f1-4cf6-a4fc-2f8d2d8e48af",
						"type": "text/javascript",
						"exec": [
							"pm.test(\"Request was successful\", function() {",
							"   pm.response.to.be.success; ",
							"});"
						]
					}
				}
			],
			"request": {
				"auth": {
					"type": "bearer",
					"bearer": [
						{
							"key": "token",
							"value": "{{iamtoken}}",
							"type": "string"
						}
					]
				},
				"method": "DELETE",
				"header": [
					{
						"key": "ibm-service-instance-id",
						"value": "{{serviceid}}"
					}
				],
				"body": {
					"mode": "raw",
					"raw": ""
				},
				"url": {
					"raw": "https://{{endpoint-region}}cloud-object-storage.appdomain.cloud/{{bucket}}kp",
					"protocol": "https",
					"host": [
						"{{endpoint-region}}",
						"objectstorage",
						"softlayer",
						"net"
					],
					"path": [
						"{{bucket}}kp"
					]
				}
			},
			"response": []
		}
	],
	"event": [
		{
			"listen": "prerequest",
			"script": {
				"id": "08caf505-3991-4273-8027-db00d867680f",
				"type": "text/javascript",
				"exec": [
					""
				]
			}
		},
		{
			"listen": "test",
			"script": {
				"id": "6e61fa13-e3b9-42f0-8c38-9d3468748922",
				"type": "text/javascript",
				"exec": [
					""
				]
			}
		}
	],
	"variable": [
		{
			"id": "643d5480-e629-4e26-b244-1b3c3a85195a",
			"key": "bucket",
			"value": "jsaitocosbucketapitest41",
			"type": "string",
			"description": ""
		},
		{
			"id": "7554e40a-f4d5-4938-972e-43b28ce52ad1",
			"key": "serviceid",
			"value": "crn:v1:bluemix:public:cloud-object-storage:global:a/1d524cd94a0dda86fd8eff3191340732:8888b05b-a143-4917-9d8e-9d5b326a1604::",
			"type": "string",
			"description": ""
		},
		{
			"id": "f06bc8b2-3476-47a6-aacb-c603dd808310",
			"key": "iamtoken",
			"value": "eyJraWQiOiIyMDE3MTAzMC0wMDowMDowMCIsImFsZyI6IlJTMjU2In0.eyJpYW1faWQiOiJJQk1pZC01MFkxNjdNOFRZIiwiaWQiOiJJQk1pZC01MFkxNjdNOFRZIiwicmVhbG1pZCI6IklCTWlkIiwiaWRlbnRpZmllciI6IjUwWTE2N004VFkiLCJnaXZlbl9uYW1lIjoiSmFtZXMiLCJmYW1pbHlfbmFtZSI6IlNhaXRvIiwibmFtZSI6IkphbWVzIFNhaXRvIiwiZW1haWwiOiJKYW1lcy5TYWl0bzFAaWJtLmNvbSIsInN1YiI6IkphbWVzLlNhaXRvMUBpYm0uY29tIiwiYWNjb3VudCI6eyJic3MiOiIxZDUyNGNkOTRhMGRkYTg2ZmQ4ZWZmMzE5MTM0MDczMiJ9LCJpYXQiOjE1Mjg2MDk0ODIsImV4cCI6MTUyODYxMzA4MiwiaXNzIjoiaHR0cHM6Ly9pYW0uYmx1ZW1peC5uZXQvaWRlbnRpdHkiLCJncmFudF90eXBlIjoidXJuOmlibTpwYXJhbXM6b2F1dGg6Z3JhbnQtdHlwZTphcGlrZXkiLCJzY29wZSI6ImlibSBvcGVuaWQiLCJjbGllbnRfaWQiOiJieCIsImFjciI6MSwiYW1yIjpbInB3ZCJdfQ.iG5ey13QlXHu3OH81v8J5sduKv3NzSqCFng_DlpNglPo07K-nWst3O9o6iEJfm0AzJwYNTZqWVru1pjI-KcAPXFBe503DPIf6cYolAw4rarU5booW-pdzk8-R5HZ7MJK7b8sxJtm7PAilXVZvl5yFE-tJsFkeMH6XCIj_R9i6dwSemDBL3Juq79_x3KsgJGFg37p5f2vck1_7gR7nSb03m8m3mCvrrx7zGkLDuM8NXAVlwwxKcitwlG_UfEBwSbX3krF04zF2tFCpGkcWAnuaFdaVTOL6uaULxCi5BWHqzLXIPhAoyfnVGNv0TBJtyFcpJ1LdlsBmz7RS2fROlDf2w",
			"type": "string",
			"description": ""
		},
		{
			"id": "dba24a46-e1df-4201-9a9b-f247fff22315",
			"key": "endpoint-region",
			"value": "s3.us-south",
			"type": "string",
			"description": ""
		},
		{
			"id": "ca751949-eea0-4f36-9f58-aea1ed324cd5",
			"key": "rootkeycrn",
			"value": "crn:v1:bluemix:public:kms:us-south:a/1d524cd94a0dda86fd8eff3191340732:90b7a1db-0fe2-4de9-b90e-922c127ff530:key:0b43e36e-a863-40e2-b713-5caa2bf99288",
			"type": "string",
			"description": ""
		},
		{
			"id": "e486732e-c9bc-4ec4-8bf9-04b66d513e5a",
			"key": "bucketlocationvault",
			"value": "us-south-vault",
			"type": "string",
			"description": ""
		}
	]
}

Importa la raccolta in Postman

  1. In Postman, fai clic su Import nell'angolo superiore destro.
  2. Importa il file della raccolta utilizzando uno di questi metodi:
    • Dalla finestra Import, trascina il file della raccolta nella finestra etichettata Drop files here
    • Fai clic sul pulsante Choose Files e passa alla cartella e seleziona il file della raccolta
  3. Ora IBM COS è presente nella finestra Collections
  4. Espandi la raccolta e vedi 20 richieste di esempio
  5. Fai clic sui tre puntini a destra della raccolta per espandere il menu e fai clic su Edit
  6. Modifica le variabili in modo che soddisfino il tuo ambiente di archiviazione Cloud
    • bucket - Immetti il nome per il nuovo bucket che vuoi creare (i nomi bucket devono essere univoci nell'archiviazione Cloud).
    • serviceid- Immetti il CRN del tuo servizio Cloud Storage. Le istruzioni per ottenere il tuo CRN sono disponibili qui.
    • iamtoken- Immetti il token OAUTH per il tuo servizio Cloud Storage. Le istruzioni per ottenere il tuo token OAUTH sono disponibili qui.
    • endpoint- Immetti l'endpoint regionale per il tuo servizio Cloud Storage. Ottieni gli endpoint disponibili dal dashboard IBM Cloud.
      • Assicurati che il tuo endpoint selezionato corrisponda al tuo servizio Key Protect per assicurarti che gli esempi vengano eseguiti correttamente
    • rootkeycrn- Il CRN della chiave root creato nel tuo servizio Key Protect primario.
      • Il CRN somiglia a crn:v1:bluemix:public:kms:us-south:a/3d624cd74a0dea86ed8efe3101341742:90b6a1db-0fe1-4fe9-b91e-962c327df531:key:0bg3e33e-a866-50f2-b715-5cba2bc93234
      • Assicurati che il servizio Key Protect selezionato corrisponda alla regione dell'endpoint
    • bucketlocationvault- Immetti il valore del vincolo di posizione per la creazione del bucket per la richiesta dell'API Crea nuovo bucket (classe di archiviazione diversa).
      • I valori accettabili includono:
        • us-south-vault
        • us-standard-flex
        • eu-cold
  7. Fai clic su Update

Esecuzione degli esempi

Le richieste API di esempio sono piuttosto semplici e facili da utilizzare. Sono progettate per essere eseguite in ordine e per dimostrare come interagire con Cloud Storage. Puoi anche eseguire un test funzionale sul tuo servizio Cloud Storage per assicurarti che funzioni correttamente.

Richiesta Risultato previsto Risultati del test
Richiama l'elenco di bucket Nel corpo, imposti un elenco XML dei bucket nella tua archiviazione cloud. La richiesta è riuscita correttamente. La risposta include il contenuto previsto
Crea un nuovo bucket Codice stato 200 OK La richiesta è riuscita
Crea un nuovo file di testo Codice stato 200 OK La richiesta è riuscita correttamente. La risposta include l'intestazione prevista
Crea un nuovo file binario Fai clic su Body e fai clic su Choose File per selezionare un'immagine da caricare. La richiesta è riuscita correttamente. La risposta include l'intestazione prevista
Richiama l'elenco di file dal bucket Nel corpo della risposta, vedi i due file che hai creato nelle richieste precedenti. La richiesta è riuscita correttamente. La risposta include l'intestazione prevista
Richiama l'elenco di file dal bucket (filtro in base al prefisso) Modificare il valore della stringa di query in prefix=<some text>. Nel corpo della risposta, vedi i file con i nomi che iniziano con il prefisso specificato. La richiesta è riuscita correttamente. La risposta include l'intestazione prevista
Richiama il file di testo Nel corpo della risposta, vedi il testo che hai immesso nella richiesta precedente La richiesta è riuscita correttamente. La risposta contiene il contenuto del corpo previsto. La risposta include l'intestazione prevista
Richiama il file binario Nel corpo della risposta, vedi l'immagine che hai scelto nella richiesta precedente. La richiesta è riuscita correttamente. La risposta include l'intestazione prevista
Richiama l'elenco di caricamenti in più parti non riusciti Nel corpo della risposta, vedi qualsiasi caricamento in più parti non riuscito per il bucket. La richiesta è riuscita correttamente. La risposta include il contenuto previsto
Richiama l'elenco dei caricamenti in più parti non riusciti (filtro in base al nome) Modificare il valore della stringa di query in prefix=<some text>. Nel corpo della risposta, vedi gli eventuali caricamenti in più parti non riusciti per il bucket con i nomi che iniziano con il prefisso specificato. La richiesta è riuscita correttamente. La risposta include il contenuto previsto
Configura il bucket abilitato a CORS Codice stato 200 OK La richiesta è riuscita
Richiama la configurazione CORS del bucket Nel corpo della risposta, vedi la configurazione CORS impostata per il bucket La richiesta è riuscita correttamente. La risposta include il contenuto previsto
Elimina la configurazione CORS del bucket Codice stato 200 OK La richiesta è riuscita
Elimina il file di testo Codice stato 200 OK La richiesta è riuscita
Elimina il file binario Codice stato 200 OK La richiesta è riuscita
Elimina bucket Codice stato 200 OK La richiesta è riuscita
Crea un nuovo bucket (classe di archiviazione diversa) Codice stato 200 OK La richiesta è riuscita
Elimina il bucket (classe di archiviazione diversa) Codice stato 200 OK La richiesta è riuscita
Crea un nuovo bucket (Key Protect) Codice stato 200 OK La richiesta è riuscita
Elimina il bucket (Key Protect) Codice stato 200 OK La richiesta è riuscita

Utilizzo di Postman Collection Runner

Postman Collection Runner fornisce un'interfaccia utente per eseguire il test di una raccolta e ti consente di eseguire tutte le richieste presenti in una raccolta contemporaneamente.

  1. Fai clic sul pulsante Runner nell'angolo in alto a destra sulla finestra Postman principale.
  2. Nella finestra Runner, seleziona la raccolta IBM COS e fai clic sul grande pulsante blu run IBM COS nella parte inferiore dello schermo.
  3. La finestra Collection Runner mostrerà le iterazioni mentre le richieste vengono eseguite. Vedrai comparire i risultati del test sotto ciascuna delle richieste.
    • Run Summary mostra una vista a griglia delle richieste e consente il filtraggio dei risultati.
    • Puoi anche fare clic su Export Results per salvare i risultati in un file JSON.