Back to Collection Items
integer li_rc
oleobject loo_Http
integer li_Success
oleobject loo_Req
oleobject loo_Resp
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
loo_Http = create oleobject
// Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
li_rc = loo_Http.ConnectToNewObject("Chilkat.Http")
if li_rc < 0 then
destroy loo_Http
MessageBox("Error","Connecting to COM object failed")
return
end if
loo_Req = create oleobject
// Use "Chilkat_9_5_0.HttpRequest" for versions of Chilkat < 10.0.0
li_rc = loo_Req.ConnectToNewObject("Chilkat.HttpRequest")
loo_Req.HttpVerb = "POST"
loo_Req.Path = "/secrets-manager/api/v1/organizations/{{organization_id}}/environments/{{environment_id}}/details/store"
loo_Req.ContentType = "multipart/form-data"
loo_Req.AddStringForUpload2("","","","","JKS")
li_Success = loo_Req.AddFileForUpload2("file"," path to file","application/octet-stream")
loo_Req.AddHeader("Expect","100-continue")
loo_Req.AddHeader("X-ANYPNT-ENV-ID","{{environment_id}}")
loo_Req.AddHeader("Authorization","Bearer {{token}}")
loo_Req.AddHeader("X-ANYPNT-ORG-ID","{{organization_id}}")
loo_Resp = loo_Http.SynchronousRequest("domain.com",443,1,loo_Req)
if loo_Http.LastMethodSuccess = 0 then
Write-Debug loo_Http.LastErrorText
destroy loo_Http
destroy loo_Req
return
end if
Write-Debug string(loo_Resp.StatusCode)
Write-Debug loo_Resp.BodyStr
destroy loo_Resp
destroy loo_Http
destroy loo_Req
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": [
]
}