unicodeC / Core Services API / ConnectRemotePeeringConnections
Back to Collection Items
#include <C_CkHttpW.h>
#include <C_CkJsonObjectW.h>
#include <C_CkHttpResponseW.h>
void ChilkatSample(void)
{
HCkHttpW http;
BOOL success;
HCkJsonObjectW json;
HCkHttpResponseW resp;
int respStatusCode;
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
http = CkHttpW_Create();
// Use this online tool to generate code from sample JSON: Generate Code to Create JSON
// The following JSON is sent in the request body.
// {
// "peerId": "pariatur nulla magna officia",
// "peerRegionName": "sit veniam"
// }
json = CkJsonObjectW_Create();
CkJsonObjectW_UpdateString(json,L"peerId",L"pariatur nulla magna officia");
CkJsonObjectW_UpdateString(json,L"peerRegionName",L"sit veniam");
CkHttpW_SetRequestHeader(http,L"Content-Type",L"application/json");
CkHttpW_SetRequestHeader(http,L"x-content-sha256",L"{{content_sha256}}");
CkHttpW_SetRequestHeader(http,L"Authorization",L"{{signature}}");
CkHttpW_SetRequestHeader(http,L"Date",L"{{date}}");
resp = CkHttpW_PostJson3(http,L"https://iaas.{{region}}.oraclecloud.com/20160918/remotePeeringConnections/:remotePeeringConnectionId/actions/connect",L"application/json",json);
if (CkHttpW_getLastMethodSuccess(http) == FALSE) {
wprintf(L"%s\n",CkHttpW_lastErrorText(http));
CkHttpW_Dispose(http);
CkJsonObjectW_Dispose(json);
return;
}
respStatusCode = CkHttpResponseW_getStatusCode(resp);
wprintf(L"Response Status Code = %d\n",respStatusCode);
if (respStatusCode != 204) {
wprintf(L"Response Header:\n");
wprintf(L"%s\n",CkHttpResponseW_header(resp));
wprintf(L"Response Body:\n");
wprintf(L"%s\n",CkHttpResponseW_bodyStr(resp));
wprintf(L"Failed.\n");
CkHttpResponseW_Dispose(resp);
CkHttpW_Dispose(http);
CkJsonObjectW_Dispose(json);
return;
}
CkHttpResponseW_Dispose(resp);
wprintf(L"Success.\n");
CkHttpW_Dispose(http);
CkJsonObjectW_Dispose(json);
}
Curl Command
curl -X POST
-H "Content-Type: application/json"
-H "Date: {{date}}"
-H "Authorization: {{signature}}"
-H "x-content-sha256: {{content_sha256}}"
-d '{
"peerId": "pariatur nulla magna officia",
"peerRegionName": "sit veniam"
}'
https://iaas.{{region}}.oraclecloud.com/20160918/remotePeeringConnections/:remotePeeringConnectionId/actions/connect
Postman Collection Item JSON
{
"name": "ConnectRemotePeeringConnections",
"request": {
"method": "POST",
"header": [
{
"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 \"peerId\": \"pariatur nulla magna officia\",\n \"peerRegionName\": \"sit veniam\"\n}"
},
"url": {
"raw": "{{baseUrl}}/remotePeeringConnections/:remotePeeringConnectionId/actions/connect",
"host": [
"{{baseUrl}}"
],
"path": [
"remotePeeringConnections",
":remotePeeringConnectionId",
"actions",
"connect"
],
"variable": [
{
"key": "remotePeeringConnectionId",
"value": "amet ut",
"description": "(Required) The [OCID](/Content/General/Concepts/identifiers.htm) of the remote peering connection (RPC)."
}
]
},
"description": "Connects this RPC to another one in a different region.\n\nThis operation must be called by the VCN administrator who is designated as\nthe *requestor* in the peering relationship. The *acceptor* must implement\nan Identity and Access Management (IAM) policy that gives the requestor permission\nto connect to RPCs in the acceptor's compartment. Without that permission, this\noperation will fail. For more information, see\n[VCN Peering](/iaas/Content/Network/Tasks/VCNpeering.htm).\n"
},
"response": [
{
"name": "The connect request was accepted and a peering is being established.",
"originalRequest": {
"method": "POST",
"header": [
],
"body": {
"mode": "raw",
"raw": "{\n \"peerId\": \"pariatur nulla magna officia\",\n \"peerRegionName\": \"sit veniam\"\n}"
},
"url": {
"raw": "{{baseUrl}}/remotePeeringConnections/:remotePeeringConnectionId/actions/connect",
"host": [
"{{baseUrl}}"
],
"path": [
"remotePeeringConnections",
":remotePeeringConnectionId",
"actions",
"connect"
],
"variable": [
{
"key": "remotePeeringConnectionId"
}
]
}
},
"status": "No Content",
"code": 204,
"_postman_previewlanguage": "text",
"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": "text/plain"
}
],
"cookie": [
],
"body": ""
},
{
"name": "Bad Request",
"originalRequest": {
"method": "POST",
"header": [
],
"body": {
"mode": "raw",
"raw": "{\n \"peerId\": \"pariatur nulla magna officia\",\n \"peerRegionName\": \"sit veniam\"\n}"
},
"url": {
"raw": "{{baseUrl}}/remotePeeringConnections/:remotePeeringConnectionId/actions/connect",
"host": [
"{{baseUrl}}"
],
"path": [
"remotePeeringConnections",
":remotePeeringConnectionId",
"actions",
"connect"
],
"variable": [
{
"key": "remotePeeringConnectionId"
}
]
}
},
"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": [
],
"body": {
"mode": "raw",
"raw": "{\n \"peerId\": \"pariatur nulla magna officia\",\n \"peerRegionName\": \"sit veniam\"\n}"
},
"url": {
"raw": "{{baseUrl}}/remotePeeringConnections/:remotePeeringConnectionId/actions/connect",
"host": [
"{{baseUrl}}"
],
"path": [
"remotePeeringConnections",
":remotePeeringConnectionId",
"actions",
"connect"
],
"variable": [
{
"key": "remotePeeringConnectionId"
}
]
}
},
"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": [
],
"body": {
"mode": "raw",
"raw": "{\n \"peerId\": \"pariatur nulla magna officia\",\n \"peerRegionName\": \"sit veniam\"\n}"
},
"url": {
"raw": "{{baseUrl}}/remotePeeringConnections/:remotePeeringConnectionId/actions/connect",
"host": [
"{{baseUrl}}"
],
"path": [
"remotePeeringConnections",
":remotePeeringConnectionId",
"actions",
"connect"
],
"variable": [
{
"key": "remotePeeringConnectionId"
}
]
}
},
"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": [
],
"body": {
"mode": "raw",
"raw": "{\n \"peerId\": \"pariatur nulla magna officia\",\n \"peerRegionName\": \"sit veniam\"\n}"
},
"url": {
"raw": "{{baseUrl}}/remotePeeringConnections/:remotePeeringConnectionId/actions/connect",
"host": [
"{{baseUrl}}"
],
"path": [
"remotePeeringConnections",
":remotePeeringConnectionId",
"actions",
"connect"
],
"variable": [
{
"key": "remotePeeringConnectionId"
}
]
}
},
"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": "Precondition Failed",
"originalRequest": {
"method": "POST",
"header": [
],
"body": {
"mode": "raw",
"raw": "{\n \"peerId\": \"pariatur nulla magna officia\",\n \"peerRegionName\": \"sit veniam\"\n}"
},
"url": {
"raw": "{{baseUrl}}/remotePeeringConnections/:remotePeeringConnectionId/actions/connect",
"host": [
"{{baseUrl}}"
],
"path": [
"remotePeeringConnections",
":remotePeeringConnectionId",
"actions",
"connect"
],
"variable": [
{
"key": "remotePeeringConnectionId"
}
]
}
},
"status": "Precondition Failed",
"code": 412,
"_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": [
],
"body": {
"mode": "raw",
"raw": "{\n \"peerId\": \"pariatur nulla magna officia\",\n \"peerRegionName\": \"sit veniam\"\n}"
},
"url": {
"raw": "{{baseUrl}}/remotePeeringConnections/:remotePeeringConnectionId/actions/connect",
"host": [
"{{baseUrl}}"
],
"path": [
"remotePeeringConnections",
":remotePeeringConnectionId",
"actions",
"connect"
],
"variable": [
{
"key": "remotePeeringConnectionId"
}
]
}
},
"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": [
],
"body": {
"mode": "raw",
"raw": "{\n \"peerId\": \"pariatur nulla magna officia\",\n \"peerRegionName\": \"sit veniam\"\n}"
},
"url": {
"raw": "{{baseUrl}}/remotePeeringConnections/:remotePeeringConnectionId/actions/connect",
"host": [
"{{baseUrl}}"
],
"path": [
"remotePeeringConnections",
":remotePeeringConnectionId",
"actions",
"connect"
],
"variable": [
{
"key": "remotePeeringConnectionId"
}
]
}
},
"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}"
}
]
}