Swift3 / Cognite API v1 / Update extraction pipelines
Back to Collection Items
func chilkatTest() {
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
let http = CkoHttp()!
var success: Bool
// Use this online tool to generate code from sample JSON: Generate Code to Create JSON
// The following JSON is sent in the request body.
// {
// "items": [
// {
// "id": 170038996366328,
// "update": {
// "externalId": {
// "set": "quis commodo minim incididunt et"
// },
// "name": {
// "set": "sed dolor Lorem in ipsum"
// },
// "description": {
// "set": "cillum nostrud sed"
// },
// "dataSetId": {
// "set": 5808835505541566
// },
// "schedule": {
// "set": "@every 82504669750µs8427843087ns555708762us7123273s051539154us5900122us91861576391ns8us34751758067m770238ns227346276ns"
// },
// "rawTables": {
// "add": [
// ],
// "remove": [
// ]
// },
// "contacts": {
// "set": [
// ]
// },
// "metadata": {
// "set": {}
// },
// "source": {
// "set": "laboris ut consectetur sint"
// },
// "documentation": {
// "set": "ullamco"
// }
// }
// },
// {
// "externalId": "ad",
// "update": {
// "externalId": {
// "set": "do non"
// },
// "name": {
// "set": "esse aliquip id dolor dolore"
// },
// "description": {
// "set": "sed quis occaecat"
// },
// "dataSetId": {
// "set": 2991526305068270
// },
// "schedule": {
// "set": "@every 005767486h236428466h76m27880668117h795ns97s784ns"
// },
// "rawTables": {
// "add": [
// ],
// "remove": [
// ]
// },
// "contacts": {
// "set": [
// ]
// },
// "metadata": {
// "add": {},
// "remove": [
// ]
// },
// "source": {
// "set": "aliquip eu ex"
// },
// "documentation": {
// "set": "ut"
// }
// }
// }
// ]
// }
let json = CkoJsonObject()!
json.updateInt("items[0].id", value: 123)
json.update("items[0].update.externalId.set", value: "quis commodo minim incididunt et")
json.update("items[0].update.name.set", value: "sed dolor Lorem in ipsum")
json.update("items[0].update.description.set", value: "cillum nostrud sed")
json.updateInt("items[0].update.dataSetId.set", value: 123)
json.update("items[0].update.schedule.set", value: "@every 82504669750µs8427843087ns555708762us7123273s051539154us5900122us91861576391ns8us34751758067m770238ns227346276ns")
json.updateNewArray("items[0].update.rawTables.add")
json.updateNewArray("items[0].update.rawTables.remove")
json.updateNewArray("items[0].update.contacts.set")
json.updateNewObject("items[0].update.metadata.set")
json.update("items[0].update.source.set", value: "laboris ut consectetur sint")
json.update("items[0].update.documentation.set", value: "ullamco")
json.update("items[1].externalId", value: "ad")
json.update("items[1].update.externalId.set", value: "do non")
json.update("items[1].update.name.set", value: "esse aliquip id dolor dolore")
json.update("items[1].update.description.set", value: "sed quis occaecat")
json.updateInt("items[1].update.dataSetId.set", value: 123)
json.update("items[1].update.schedule.set", value: "@every 005767486h236428466h76m27880668117h795ns97s784ns")
json.updateNewArray("items[1].update.rawTables.add")
json.updateNewArray("items[1].update.rawTables.remove")
json.updateNewArray("items[1].update.contacts.set")
json.updateNewObject("items[1].update.metadata.add")
json.updateNewArray("items[1].update.metadata.remove")
json.update("items[1].update.source.set", value: "aliquip eu ex")
json.update("items[1].update.documentation.set", value: "ut")
http.setRequestHeader("content-type", value: "application/json")
http.setRequestHeader("api-key", value: "{{api-key}}")
var resp: CkoHttpResponse? = http.postJson3("https://domain.com/api/v1/projects/{{project}}/extpipes/update", contentType: "application/json", json: json)
if http.lastMethodSuccess == false {
print("\(http.lastErrorText!)")
return
}
print("\(resp!.statusCode.intValue)")
print("\(resp!.bodyStr!)")
resp = nil
}
Curl Command
curl -X POST
-H "api-key: {{api-key}}"
-H "content-type: application/json"
-d '{
"items": [
{
"id": 170038996366328,
"update": {
"externalId": {
"set": "quis commodo minim incididunt et"
},
"name": {
"set": "sed dolor Lorem in ipsum"
},
"description": {
"set": "cillum nostrud sed"
},
"dataSetId": {
"set": 5808835505541566
},
"schedule": {
"set": "@every 82504669750µs8427843087ns555708762us7123273s051539154us5900122us91861576391ns8us34751758067m770238ns227346276ns"
},
"rawTables": {
"add": [],
"remove": []
},
"contacts": {
"set": []
},
"metadata": {
"set": {}
},
"source": {
"set": "laboris ut consectetur sint"
},
"documentation": {
"set": "ullamco"
}
}
},
{
"externalId": "ad",
"update": {
"externalId": {
"set": "do non"
},
"name": {
"set": "esse aliquip id dolor dolore"
},
"description": {
"set": "sed quis occaecat"
},
"dataSetId": {
"set": 2991526305068270
},
"schedule": {
"set": "@every 005767486h236428466h76m27880668117h795ns97s784ns"
},
"rawTables": {
"add": [],
"remove": []
},
"contacts": {
"set": []
},
"metadata": {
"add": {},
"remove": []
},
"source": {
"set": "aliquip eu ex"
},
"documentation": {
"set": "ut"
}
}
}
]
}'
https://domain.com/api/v1/projects/{{project}}/extpipes/update
Postman Collection Item JSON
{
"id": "updateExtPipes",
"name": "Update extraction pipelines",
"request": {
"url": {
"host": "{{baseUrl}}",
"path": [
"api",
"v1",
"projects",
"{{project}}",
"extpipes",
"update"
],
"query": [
],
"variable": [
]
},
"method": "POST",
"header": [
{
"key": "api-key",
"value": "{{api-key}}",
"description": "An admin can create API keys in the Cognite console."
},
{
"key": "content-type",
"value": "application/json"
}
],
"description": "Update information for a list of extraction pipelines. Fields that are not included in the request, are not changed.",
"body": {
"mode": "raw",
"raw": "{\n \"items\": [\n {\n \"id\": 170038996366328,\n \"update\": {\n \"externalId\": {\n \"set\": \"quis commodo minim incididunt et\"\n },\n \"name\": {\n \"set\": \"sed dolor Lorem in ipsum\"\n },\n \"description\": {\n \"set\": \"cillum nostrud sed\"\n },\n \"dataSetId\": {\n \"set\": 5808835505541566\n },\n \"schedule\": {\n \"set\": \"@every 82504669750µs8427843087ns555708762us7123273s051539154us5900122us91861576391ns8us34751758067m770238ns227346276ns\"\n },\n \"rawTables\": {\n \"add\": [],\n \"remove\": []\n },\n \"contacts\": {\n \"set\": []\n },\n \"metadata\": {\n \"set\": {}\n },\n \"source\": {\n \"set\": \"laboris ut consectetur sint\"\n },\n \"documentation\": {\n \"set\": \"ullamco\"\n }\n }\n },\n {\n \"externalId\": \"ad\",\n \"update\": {\n \"externalId\": {\n \"set\": \"do non\"\n },\n \"name\": {\n \"set\": \"esse aliquip id dolor dolore\"\n },\n \"description\": {\n \"set\": \"sed quis occaecat\"\n },\n \"dataSetId\": {\n \"set\": 2991526305068270\n },\n \"schedule\": {\n \"set\": \"@every 005767486h236428466h76m27880668117h795ns97s784ns\"\n },\n \"rawTables\": {\n \"add\": [],\n \"remove\": []\n },\n \"contacts\": {\n \"set\": []\n },\n \"metadata\": {\n \"add\": {},\n \"remove\": []\n },\n \"source\": {\n \"set\": \"aliquip eu ex\"\n },\n \"documentation\": {\n \"set\": \"ut\"\n }\n }\n }\n ]\n}"
}
}
}