Back to Collection Items
LOCAL loHttp
LOCAL lnSuccess
LOCAL loReq
LOCAL loResp
* 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')
loHttp = CreateObject('Chilkat.Http')
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.HttpRequest')
loReq = CreateObject('Chilkat.HttpRequest')
loReq.HttpVerb = "POST"
loReq.Path = "/apimanager/api/v1/organizations/{{organization_id}}/environments/{{environment_id}}/apis"
loReq.ContentType = "multipart/form-data"
lnSuccess = loReq.AddFileForUpload2("file"," path to file","application/octet-stream")
loReq.AddHeader("Authorization","Bearer {{token}}")
loReq.AddHeader("Expect","100-continue")
loResp = loHttp.SynchronousRequest("domain.com",443,1,loReq)
IF (loHttp.LastMethodSuccess = 0) THEN
? loHttp.LastErrorText
RELEASE loHttp
RELEASE loReq
CANCEL
ENDIF
? STR(loResp.StatusCode)
? loResp.BodyStr
RELEASE loResp
RELEASE loHttp
RELEASE loReq
Curl Command
curl -X POST
-H "Authorization: Bearer {{token}}"
--form 'file=@"/path/to/file"'
https://domain.com/apimanager/api/v1/organizations/{{organization_id}}/environments/{{environment_id}}/apis
Postman Collection Item JSON
{
"name": "Import api as zip",
"protocolProfileBehavior": {
"disabledSystemHeaders": {}
},
"request": {
"method": "POST",
"header": [
{
"key": "Authorization",
"value": "Bearer {{token}}",
"type": "text"
}
],
"body": {
"mode": "formdata",
"formdata": [
{
"key": "file",
"type": "file",
"src": "shop-locator-v1-16802092.zip"
}
]
},
"url": {
"raw": "{{url}}/apimanager/api/v1/organizations/{{organization_id}}/environments/{{environment_id}}/apis",
"host": [
"{{url}}"
],
"path": [
"apimanager",
"api",
"v1",
"organizations",
"{{organization_id}}",
"environments",
"{{environment_id}}",
"apis"
]
}
},
"response": [
]
}