Chilkat Online Tools

autoit / Anypoint Platform APIs / Check certificate content

Back to Collection Items

; This example assumes the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.

$oHttp = ObjCreate("Chilkat_9_5_0.Http")
Local $bSuccess

$oReq = ObjCreate("Chilkat_9_5_0.HttpRequest")
$oReq.HttpVerb = "POST"
$oReq.Path = "/secrets-manager/api/v1/organizations/{{organization_id}}/environments/{{environment_id}}/details/store"
$oReq.ContentType = "multipart/form-data"
$oReq.AddParam "",""

$bSuccess = $oReq.AddFileForUpload2("file"," path to file","application/octet-stream")

$oReq.AddHeader "Expect","100-continue"
$oReq.AddHeader "X-ANYPNT-ENV-ID","{{environment_id}}"
$oReq.AddHeader "Authorization","Bearer {{token}}"
$oReq.AddHeader "X-ANYPNT-ORG-ID","{{organization_id}}"

Local $oResp = $oHttp.SynchronousRequest("domain.com",443,True,$oReq)
If ($oHttp.LastMethodSuccess = False) Then
    ConsoleWrite($oHttp.LastErrorText & @CRLF)
    Exit
EndIf

ConsoleWrite($oResp.StatusCode & @CRLF)
ConsoleWrite($oResp.BodyStr & @CRLF)

Curl Command

curl -X POST
	-H "Authorization: Bearer {{token}}"
	-H "X-ANYPNT-ORG-ID: {{organization_id}}"
	-H "X-ANYPNT-ENV-ID: {{environment_id}}"
	--form 'type=JKS'
	--form 'file=@"/path/to/file"'
https://domain.com/secrets-manager/api/v1/organizations/{{organization_id}}/environments/{{environment_id}}/details/store

Postman Collection Item JSON

{
  "name": "Check certificate content",
  "request": {
    "method": "POST",
    "header": [
      {
        "key": "Authorization",
        "value": "Bearer {{token}}",
        "type": "text"
      },
      {
        "key": "X-ANYPNT-ORG-ID",
        "value": "{{organization_id}}",
        "type": "text"
      },
      {
        "key": "X-ANYPNT-ENV-ID",
        "value": "{{environment_id}}",
        "type": "text"
      }
    ],
    "body": {
      "mode": "formdata",
      "formdata": [
        {
          "key": "type",
          "value": "JKS",
          "type": "text"
        },
        {
          "key": "file",
          "type": "file",
          "src": "/C:/Users/khanamir/abc.jks"
        },
        {
          "key": "storePassphrase",
          "value": "!Q2w3e4r5",
          "type": "text"
        }
      ]
    },
    "url": {
      "raw": "{{url}}/secrets-manager/api/v1/organizations/{{organization_id}}/environments/{{environment_id}}/details/store",
      "host": [
        "{{url}}"
      ],
      "path": [
        "secrets-manager",
        "api",
        "v1",
        "organizations",
        "{{organization_id}}",
        "environments",
        "{{environment_id}}",
        "details",
        "store"
      ]
    }
  },
  "response": [
  ]
}