Back to Collection Items
Dim fso, outFile
Set fso = CreateObject("Scripting.FileSystemObject")
'Create a Unicode (utf-16) output text file.
Set outFile = fso.CreateTextFile("output.txt", True, True)
' This example assumes the Chilkat API to have been previously unlocked.
' See Global Unlock Sample for sample code.
' For versions of Chilkat < 10.0.0, use CreateObject("Chilkat_9_5_0.Http")
set http = CreateObject("Chilkat.Http")
' Use this online tool to generate code from sample JSON: Generate Code to Create JSON
' The following JSON is sent in the request body.
' {
' "compartmentId": "{{compartment_ocid}}",
' "cidrBlock": "laboris qui id proident",
' "cidrBlocks": [
' "dolore deserunt",
' "nulla elit proident"
' ],
' "definedTags": {},
' "displayName": "reprehenderit pariatur ipsum quis",
' "dnsLabel": "magn",
' "freeformTags": {},
' "ipv6CidrBlock": "velit aliquip dolore",
' "isIpv6Enabled": true
' }
' For versions of Chilkat < 10.0.0, use CreateObject("Chilkat_9_5_0.JsonObject")
set json = CreateObject("Chilkat.JsonObject")
success = json.UpdateString("compartmentId","{{compartment_ocid}}")
success = json.UpdateString("cidrBlock","laboris qui id proident")
success = json.UpdateString("cidrBlocks[0]","dolore deserunt")
success = json.UpdateString("cidrBlocks[1]","nulla elit proident")
success = json.UpdateNewObject("definedTags")
success = json.UpdateString("displayName","reprehenderit pariatur ipsum quis")
success = json.UpdateString("dnsLabel","magn")
success = json.UpdateNewObject("freeformTags")
success = json.UpdateString("ipv6CidrBlock","velit aliquip dolore")
success = json.UpdateBool("isIpv6Enabled",1)
http.SetRequestHeader "opc-retry-token","aliqua enim i"
http.SetRequestHeader "Content-Type","application/json"
http.SetRequestHeader "x-content-sha256","{{content_sha256}}"
http.SetRequestHeader "Authorization","{{signature}}"
http.SetRequestHeader "Date","{{date}}"
' resp is a Chilkat.HttpResponse
Set resp = http.PostJson3("https://iaas.{{region}}.oraclecloud.com/20160918/vcns","application/json",json)
If (http.LastMethodSuccess = 0) Then
outFile.WriteLine(http.LastErrorText)
WScript.Quit
End If
' For versions of Chilkat < 10.0.0, use CreateObject("Chilkat_9_5_0.StringBuilder")
set sbResponseBody = CreateObject("Chilkat.StringBuilder")
success = resp.GetBodySb(sbResponseBody)
' For versions of Chilkat < 10.0.0, use CreateObject("Chilkat_9_5_0.JsonObject")
set jResp = CreateObject("Chilkat.JsonObject")
success = jResp.LoadSb(sbResponseBody)
jResp.EmitCompact = 0
outFile.WriteLine("Response Body:")
outFile.WriteLine(jResp.Emit())
respStatusCode = resp.StatusCode
outFile.WriteLine("Response Status Code = " & respStatusCode)
If (respStatusCode >= 400) Then
outFile.WriteLine("Response Header:")
outFile.WriteLine(resp.Header)
outFile.WriteLine("Failed.")
WScript.Quit
End If
' Sample JSON response:
' (Sample code for parsing the JSON response is shown below)
' {
' "id": "id magna consectetur",
' "compartmentId": "proident ullamco et non",
' "cidrBlock": "ut amet la",
' "lifecycleState": "TERMINATING",
' "cidrBlocks": [
' "et",
' "amet"
' ],
' "defaultDhcpOptionsId": "qui officia reprehenderit Ut",
' "defaultRouteTableId": "nulla incididunt exercitation fugiat",
' "defaultSecurityListId": "eiusmod sint aliqua",
' "definedTags": {},
' "displayName": "in",
' "dnsLabel": "qui cupida",
' "freeformTags": {},
' "ipv6CidrBlock": "aute Excepteur",
' "ipv6PublicCidrBlock": "dolore ex dolor Lorem adipisicing",
' "timeCreated": "1985-03-26T20:05:22.459Z",
' "vcnDomainName": "ex laborum magna"
' }
' Sample code for parsing the JSON response...
' Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
id = jResp.StringOf("id")
compartmentId = jResp.StringOf("compartmentId")
cidrBlock = jResp.StringOf("cidrBlock")
lifecycleState = jResp.StringOf("lifecycleState")
defaultDhcpOptionsId = jResp.StringOf("defaultDhcpOptionsId")
defaultRouteTableId = jResp.StringOf("defaultRouteTableId")
defaultSecurityListId = jResp.StringOf("defaultSecurityListId")
displayName = jResp.StringOf("displayName")
dnsLabel = jResp.StringOf("dnsLabel")
ipv6CidrBlock = jResp.StringOf("ipv6CidrBlock")
ipv6PublicCidrBlock = jResp.StringOf("ipv6PublicCidrBlock")
timeCreated = jResp.StringOf("timeCreated")
vcnDomainName = jResp.StringOf("vcnDomainName")
i = 0
count_i = jResp.SizeOfArray("cidrBlocks")
Do While i < count_i
jResp.I = i
strVal = jResp.StringOf("cidrBlocks[i]")
i = i + 1
Loop
outFile.Close
Curl Command
curl -X POST
-H "opc-retry-token: aliqua enim i"
-H "Content-Type: application/json"
-H "Date: {{date}}"
-H "Authorization: {{signature}}"
-H "x-content-sha256: {{content_sha256}}"
-d '{
"compartmentId": "{{compartment_ocid}}",
"cidrBlock": "laboris qui id proident",
"cidrBlocks": [
"dolore deserunt",
"nulla elit proident"
],
"definedTags": {},
"displayName": "reprehenderit pariatur ipsum quis",
"dnsLabel": "magn",
"freeformTags": {},
"ipv6CidrBlock": "velit aliquip dolore",
"isIpv6Enabled": true
}'
https://iaas.{{region}}.oraclecloud.com/20160918/vcns
Postman Collection Item JSON
{
"name": "CreateVcn",
"request": {
"method": "POST",
"header": [
{
"description": "A token that uniquely identifies a request so it can be retried in case of a timeout or\nserver error without risk of executing that same action again. Retry tokens expire after 24\nhours, but can be invalidated before then due to conflicting operations (for example, if a resource\nhas been deleted and purged from the system, then a retry of the original creation request\nmay be rejected).\n",
"key": "opc-retry-token",
"value": "aliqua enim i"
},
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Date",
"value": "{{date}}",
"description": "(Required) Current Date",
"type": "text"
},
{
"key": "Authorization",
"value": "{{signature}}",
"description": "(Required) Signature Authentication on Authorization header",
"type": "text"
},
{
"key": "x-content-sha256",
"value": "{{content_sha256}}",
"description": "(Required) Content sha256 for POST, PUT and PATCH operations",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"compartmentId\": \"{{compartment_ocid}}\",\n \"cidrBlock\": \"laboris qui id proident\",\n \"cidrBlocks\": [\n \"dolore deserunt\",\n \"nulla elit proident\"\n ],\n \"definedTags\": {},\n \"displayName\": \"reprehenderit pariatur ipsum quis\",\n \"dnsLabel\": \"magn\",\n \"freeformTags\": {},\n \"ipv6CidrBlock\": \"velit aliquip dolore\",\n \"isIpv6Enabled\": true\n}"
},
"url": {
"raw": "{{baseUrl}}/vcns",
"host": [
"{{baseUrl}}"
],
"path": [
"vcns"
]
},
"description": "Creates a new virtual cloud network (VCN). For more information, see\n[VCNs and Subnets](/iaas/Content/Network/Tasks/managingVCNs.htm).\n\nFor the VCN, you specify a list of one or more IPv4 CIDR blocks that meet the following criteria:\n\n- The CIDR blocks must be valid.\n- They must not overlap with each other or with the on-premises network CIDR block. \n- The number of CIDR blocks does not exceed the limit of CIDR blocks allowed per VCN.\n\nFor a CIDR block, Oracle recommends that you use one of the private IP address ranges specified in [RFC 1918](https://tools.ietf.org/html/rfc1918) (10.0.0.0/8, 172.16/12, and 192.168/16). Example:\n172.16.0.0/16. The CIDR blocks can range from /16 to /30.\n\nFor the purposes of access control, you must provide the [OCID](/iaas/Content/General/Concepts/identifiers.htm) of the compartment where you want the VCN to\nreside. Consult an Oracle Cloud Infrastructure administrator in your organization if you're not sure which\ncompartment to use. Notice that the VCN doesn't have to be in the same compartment as the subnets or other\nNetworking Service components. For more information about compartments and access control, see\n[Overview of the IAM Service](/iaas/Content/Identity/Concepts/overview.htm). For information about OCIDs, see\n[Resource Identifiers](/iaas/Content/General/Concepts/identifiers.htm).\n\nYou may optionally specify a *display name* for the VCN, otherwise a default is provided. It does not have to\nbe unique, and you can change it. Avoid entering confidential information.\n\nYou can also add a DNS label for the VCN, which is required if you want the instances to use the\nInterent and VCN Resolver option for DNS in the VCN. For more information, see\n[DNS in Your Virtual Cloud Network](/iaas/Content/Network/Concepts/dns.htm).\n\nThe VCN automatically comes with a default route table, default security list, and default set of DHCP options.\nThe [OCID](/iaas/Content/General/Concepts/identifiers.htm) for each is returned in the response. You can't delete these default objects, but you can change their\ncontents (that is, change the route rules, security list rules, and so on).\n\nThe VCN and subnets you create are not accessible until you attach an internet gateway or set up a Site-to-Site VPN\nor FastConnect. For more information, see\n[Overview of the Networking Service](/iaas/Content/Network/Concepts/overview.htm).\n"
},
"response": [
{
"name": "The VCN was created.",
"originalRequest": {
"method": "POST",
"header": [
{
"description": "A token that uniquely identifies a request so it can be retried in case of a timeout or\nserver error without risk of executing that same action again. Retry tokens expire after 24\nhours, but can be invalidated before then due to conflicting operations (for example, if a resource\nhas been deleted and purged from the system, then a retry of the original creation request\nmay be rejected).\n",
"key": "opc-retry-token",
"value": "aliqua enim i"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"compartmentId\": \"pariatur\",\n \"cidrBlock\": \"laboris qui id proident\",\n \"cidrBlocks\": [\n \"dolore deserunt\",\n \"nulla elit proident\"\n ],\n \"definedTags\": {},\n \"displayName\": \"reprehenderit pariatur ipsum quis\",\n \"dnsLabel\": \"magn\",\n \"freeformTags\": {},\n \"ipv6CidrBlock\": \"velit aliquip dolore\",\n \"isIpv6Enabled\": true\n}"
},
"url": {
"raw": "{{baseUrl}}/vcns",
"host": [
"{{baseUrl}}"
],
"path": [
"vcns"
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "etag",
"value": "officia sed",
"description": "For optimistic concurrency control. See `if-match`.\n"
},
{
"key": "opc-request-id",
"value": "officia sed",
"description": "Unique Oracle-assigned identifier for the request. If you need to contact\nOracle about a particular request, please provide the request ID.\n"
},
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"id\": \"id magna consectetur\",\n \"compartmentId\": \"proident ullamco et non\",\n \"cidrBlock\": \"ut amet la\",\n \"lifecycleState\": \"TERMINATING\",\n \"cidrBlocks\": [\n \"et\",\n \"amet\"\n ],\n \"defaultDhcpOptionsId\": \"qui officia reprehenderit Ut\",\n \"defaultRouteTableId\": \"nulla incididunt exercitation fugiat\",\n \"defaultSecurityListId\": \"eiusmod sint aliqua\",\n \"definedTags\": {},\n \"displayName\": \"in\",\n \"dnsLabel\": \"qui cupida\",\n \"freeformTags\": {},\n \"ipv6CidrBlock\": \"aute Excepteur\",\n \"ipv6PublicCidrBlock\": \"dolore ex dolor Lorem adipisicing\",\n \"timeCreated\": \"1985-03-26T20:05:22.459Z\",\n \"vcnDomainName\": \"ex laborum magna\"\n}"
},
{
"name": "Bad Request",
"originalRequest": {
"method": "POST",
"header": [
{
"description": "A token that uniquely identifies a request so it can be retried in case of a timeout or\nserver error without risk of executing that same action again. Retry tokens expire after 24\nhours, but can be invalidated before then due to conflicting operations (for example, if a resource\nhas been deleted and purged from the system, then a retry of the original creation request\nmay be rejected).\n",
"key": "opc-retry-token",
"value": "aliqua enim i"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"compartmentId\": \"pariatur\",\n \"cidrBlock\": \"laboris qui id proident\",\n \"cidrBlocks\": [\n \"dolore deserunt\",\n \"nulla elit proident\"\n ],\n \"definedTags\": {},\n \"displayName\": \"reprehenderit pariatur ipsum quis\",\n \"dnsLabel\": \"magn\",\n \"freeformTags\": {},\n \"ipv6CidrBlock\": \"velit aliquip dolore\",\n \"isIpv6Enabled\": true\n}"
},
"url": {
"raw": "{{baseUrl}}/vcns",
"host": [
"{{baseUrl}}"
],
"path": [
"vcns"
]
}
},
"status": "Bad Request",
"code": 400,
"_postman_previewlanguage": "json",
"header": [
{
"key": "opc-request-id",
"value": "officia sed",
"description": "Unique Oracle-assigned identifier for the request. If you need to contact\nOracle about a particular request, please provide the request ID.\n"
},
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"code\": \"et exercitation Excepteur\",\n \"message\": \"irure sit\"\n}"
},
{
"name": "Unauthorized",
"originalRequest": {
"method": "POST",
"header": [
{
"description": "A token that uniquely identifies a request so it can be retried in case of a timeout or\nserver error without risk of executing that same action again. Retry tokens expire after 24\nhours, but can be invalidated before then due to conflicting operations (for example, if a resource\nhas been deleted and purged from the system, then a retry of the original creation request\nmay be rejected).\n",
"key": "opc-retry-token",
"value": "aliqua enim i"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"compartmentId\": \"pariatur\",\n \"cidrBlock\": \"laboris qui id proident\",\n \"cidrBlocks\": [\n \"dolore deserunt\",\n \"nulla elit proident\"\n ],\n \"definedTags\": {},\n \"displayName\": \"reprehenderit pariatur ipsum quis\",\n \"dnsLabel\": \"magn\",\n \"freeformTags\": {},\n \"ipv6CidrBlock\": \"velit aliquip dolore\",\n \"isIpv6Enabled\": true\n}"
},
"url": {
"raw": "{{baseUrl}}/vcns",
"host": [
"{{baseUrl}}"
],
"path": [
"vcns"
]
}
},
"status": "Unauthorized",
"code": 401,
"_postman_previewlanguage": "json",
"header": [
{
"key": "opc-request-id",
"value": "officia sed",
"description": "Unique Oracle-assigned identifier for the request. If you need to contact\nOracle about a particular request, please provide the request ID.\n"
},
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"code\": \"et exercitation Excepteur\",\n \"message\": \"irure sit\"\n}"
},
{
"name": "Not Found",
"originalRequest": {
"method": "POST",
"header": [
{
"description": "A token that uniquely identifies a request so it can be retried in case of a timeout or\nserver error without risk of executing that same action again. Retry tokens expire after 24\nhours, but can be invalidated before then due to conflicting operations (for example, if a resource\nhas been deleted and purged from the system, then a retry of the original creation request\nmay be rejected).\n",
"key": "opc-retry-token",
"value": "aliqua enim i"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"compartmentId\": \"pariatur\",\n \"cidrBlock\": \"laboris qui id proident\",\n \"cidrBlocks\": [\n \"dolore deserunt\",\n \"nulla elit proident\"\n ],\n \"definedTags\": {},\n \"displayName\": \"reprehenderit pariatur ipsum quis\",\n \"dnsLabel\": \"magn\",\n \"freeformTags\": {},\n \"ipv6CidrBlock\": \"velit aliquip dolore\",\n \"isIpv6Enabled\": true\n}"
},
"url": {
"raw": "{{baseUrl}}/vcns",
"host": [
"{{baseUrl}}"
],
"path": [
"vcns"
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "json",
"header": [
{
"key": "opc-request-id",
"value": "officia sed",
"description": "Unique Oracle-assigned identifier for the request. If you need to contact\nOracle about a particular request, please provide the request ID.\n"
},
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"code\": \"et exercitation Excepteur\",\n \"message\": \"irure sit\"\n}"
},
{
"name": "Conflict",
"originalRequest": {
"method": "POST",
"header": [
{
"description": "A token that uniquely identifies a request so it can be retried in case of a timeout or\nserver error without risk of executing that same action again. Retry tokens expire after 24\nhours, but can be invalidated before then due to conflicting operations (for example, if a resource\nhas been deleted and purged from the system, then a retry of the original creation request\nmay be rejected).\n",
"key": "opc-retry-token",
"value": "aliqua enim i"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"compartmentId\": \"pariatur\",\n \"cidrBlock\": \"laboris qui id proident\",\n \"cidrBlocks\": [\n \"dolore deserunt\",\n \"nulla elit proident\"\n ],\n \"definedTags\": {},\n \"displayName\": \"reprehenderit pariatur ipsum quis\",\n \"dnsLabel\": \"magn\",\n \"freeformTags\": {},\n \"ipv6CidrBlock\": \"velit aliquip dolore\",\n \"isIpv6Enabled\": true\n}"
},
"url": {
"raw": "{{baseUrl}}/vcns",
"host": [
"{{baseUrl}}"
],
"path": [
"vcns"
]
}
},
"status": "Conflict",
"code": 409,
"_postman_previewlanguage": "json",
"header": [
{
"key": "opc-request-id",
"value": "officia sed",
"description": "Unique Oracle-assigned identifier for the request. If you need to contact\nOracle about a particular request, please provide the request ID.\n"
},
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"code\": \"et exercitation Excepteur\",\n \"message\": \"irure sit\"\n}"
},
{
"name": "Internal Server Error",
"originalRequest": {
"method": "POST",
"header": [
{
"description": "A token that uniquely identifies a request so it can be retried in case of a timeout or\nserver error without risk of executing that same action again. Retry tokens expire after 24\nhours, but can be invalidated before then due to conflicting operations (for example, if a resource\nhas been deleted and purged from the system, then a retry of the original creation request\nmay be rejected).\n",
"key": "opc-retry-token",
"value": "aliqua enim i"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"compartmentId\": \"pariatur\",\n \"cidrBlock\": \"laboris qui id proident\",\n \"cidrBlocks\": [\n \"dolore deserunt\",\n \"nulla elit proident\"\n ],\n \"definedTags\": {},\n \"displayName\": \"reprehenderit pariatur ipsum quis\",\n \"dnsLabel\": \"magn\",\n \"freeformTags\": {},\n \"ipv6CidrBlock\": \"velit aliquip dolore\",\n \"isIpv6Enabled\": true\n}"
},
"url": {
"raw": "{{baseUrl}}/vcns",
"host": [
"{{baseUrl}}"
],
"path": [
"vcns"
]
}
},
"status": "Internal Server Error",
"code": 500,
"_postman_previewlanguage": "json",
"header": [
{
"key": "opc-request-id",
"value": "officia sed",
"description": "Unique Oracle-assigned identifier for the request. If you need to contact\nOracle about a particular request, please provide the request ID.\n"
},
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"code\": \"et exercitation Excepteur\",\n \"message\": \"irure sit\"\n}"
},
{
"name": "An error has occurred.",
"originalRequest": {
"method": "POST",
"header": [
{
"description": "A token that uniquely identifies a request so it can be retried in case of a timeout or\nserver error without risk of executing that same action again. Retry tokens expire after 24\nhours, but can be invalidated before then due to conflicting operations (for example, if a resource\nhas been deleted and purged from the system, then a retry of the original creation request\nmay be rejected).\n",
"key": "opc-retry-token",
"value": "aliqua enim i"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"compartmentId\": \"pariatur\",\n \"cidrBlock\": \"laboris qui id proident\",\n \"cidrBlocks\": [\n \"dolore deserunt\",\n \"nulla elit proident\"\n ],\n \"definedTags\": {},\n \"displayName\": \"reprehenderit pariatur ipsum quis\",\n \"dnsLabel\": \"magn\",\n \"freeformTags\": {},\n \"ipv6CidrBlock\": \"velit aliquip dolore\",\n \"isIpv6Enabled\": true\n}"
},
"url": {
"raw": "{{baseUrl}}/vcns",
"host": [
"{{baseUrl}}"
],
"path": [
"vcns"
]
}
},
"status": "Internal Server Error",
"code": 500,
"_postman_previewlanguage": "json",
"header": [
{
"key": "opc-request-id",
"value": "officia sed",
"description": "Unique Oracle-assigned identifier for the request. If you need to contact\nOracle about a particular request, please provide the request ID.\n"
},
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"code\": \"et exercitation Excepteur\",\n \"message\": \"irure sit\"\n}"
}
]
}