Android / Cognite API v1 / Search sequences
Back to Collection Items
// Important: Don't forget to include the call to System.loadLibrary
// as shown at the bottom of this code sample.
package com.test;
import android.app.Activity;
import com.chilkatsoft.*;
import android.widget.TextView;
import android.os.Bundle;
public class SimpleActivity extends Activity {
private static final String TAG = "Chilkat";
// Called when the activity is first created.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
CkHttp http = new CkHttp();
boolean success;
// Use this online tool to generate code from sample JSON: Generate Code to Create JSON
// The following JSON is sent in the request body.
// {
// "filter": {
// "name": "commodo non nulla aute",
// "externalIdPrefix": "commodo qui cupidatat",
// "metadata": {},
// "assetIds": [
// 4769293985777598,
// 5785768360784284
// ],
// "rootAssetIds": [
// 1096264439313816,
// 4922424346728832
// ],
// "assetSubtreeIds": [
// {
// "externalId": "exercitation pariatur id in"
// },
// {
// "id": 22443661565144
// }
// ],
// "createdTime": {
// "max": 14384577,
// "min": 60974975
// },
// "lastUpdatedTime": {
// "max": 83207483,
// "min": 43920599
// },
// "dataSetIds": [
// {
// "externalId": "voluptate e"
// },
// {
// "externalId": "laboris"
// }
// ]
// },
// "search": {
// "name": "non culpa irure velit consequat",
// "description": "id eiusmod",
// "query": "ad"
// },
// "limit": 100
// }
CkJsonObject json = new CkJsonObject();
json.UpdateString("filter.name","commodo non nulla aute");
json.UpdateString("filter.externalIdPrefix","commodo qui cupidatat");
json.UpdateNewObject("filter.metadata");
json.UpdateInt("filter.assetIds[0]",4769293985777598);
json.UpdateInt("filter.assetIds[1]",5785768360784284);
json.UpdateInt("filter.rootAssetIds[0]",1096264439313816);
json.UpdateInt("filter.rootAssetIds[1]",4922424346728832);
json.UpdateString("filter.assetSubtreeIds[0].externalId","exercitation pariatur id in");
json.UpdateInt("filter.assetSubtreeIds[1].id",123);
json.UpdateInt("filter.createdTime.max",14384577);
json.UpdateInt("filter.createdTime.min",60974975);
json.UpdateInt("filter.lastUpdatedTime.max",83207483);
json.UpdateInt("filter.lastUpdatedTime.min",43920599);
json.UpdateString("filter.dataSetIds[0].externalId","voluptate e");
json.UpdateString("filter.dataSetIds[1].externalId","laboris");
json.UpdateString("search.name","non culpa irure velit consequat");
json.UpdateString("search.description","id eiusmod");
json.UpdateString("search.query","ad");
json.UpdateInt("limit",100);
http.SetRequestHeader("content-type","application/json");
http.SetRequestHeader("api-key","{{api-key}}");
CkHttpResponse resp = http.PostJson3("https://domain.com/api/v1/projects/{{project}}/sequences/search","application/json",json);
if (http.get_LastMethodSuccess() == false) {
Log.i(TAG, http.lastErrorText());
return;
}
Log.i(TAG, String.valueOf(resp.get_StatusCode()));
Log.i(TAG, resp.bodyStr());
}
static {
System.loadLibrary("chilkat");
// Note: If the incorrect library name is passed to System.loadLibrary,
// then you will see the following error message at application startup:
//"The application <your-application-name> has stopped unexpectedly. Please try again."
}
}
Curl Command
curl -X POST
-H "api-key: {{api-key}}"
-H "content-type: application/json"
-d '{
"filter": {
"name": "commodo non nulla aute",
"externalIdPrefix": "commodo qui cupidatat",
"metadata": {},
"assetIds": [
4769293985777598,
5785768360784284
],
"rootAssetIds": [
1096264439313816,
4922424346728832
],
"assetSubtreeIds": [
{
"externalId": "exercitation pariatur id in"
},
{
"id": 22443661565144
}
],
"createdTime": {
"max": 14384577,
"min": 60974975
},
"lastUpdatedTime": {
"max": 83207483,
"min": 43920599
},
"dataSetIds": [
{
"externalId": "voluptate e"
},
{
"externalId": "laboris"
}
]
},
"search": {
"name": "non culpa irure velit consequat",
"description": "id eiusmod",
"query": "ad"
},
"limit": 100
}'
https://domain.com/api/v1/projects/{{project}}/sequences/search
Postman Collection Item JSON
{
"id": "searchSequences",
"name": "Search sequences",
"request": {
"url": {
"host": "{{baseUrl}}",
"path": [
"api",
"v1",
"projects",
"{{project}}",
"sequences",
"search"
],
"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": "Retrieves a list of sequences matching the given criteria. This operation does not support pagination.",
"body": {
"mode": "raw",
"raw": "{\n \"filter\": {\n \"name\": \"commodo non nulla aute\",\n \"externalIdPrefix\": \"commodo qui cupidatat\",\n \"metadata\": {},\n \"assetIds\": [\n 4769293985777598,\n 5785768360784284\n ],\n \"rootAssetIds\": [\n 1096264439313816,\n 4922424346728832\n ],\n \"assetSubtreeIds\": [\n {\n \"externalId\": \"exercitation pariatur id in\"\n },\n {\n \"id\": 22443661565144\n }\n ],\n \"createdTime\": {\n \"max\": 14384577,\n \"min\": 60974975\n },\n \"lastUpdatedTime\": {\n \"max\": 83207483,\n \"min\": 43920599\n },\n \"dataSetIds\": [\n {\n \"externalId\": \"voluptate e\"\n },\n {\n \"externalId\": \"laboris\"\n }\n ]\n },\n \"search\": {\n \"name\": \"non culpa irure velit consequat\",\n \"description\": \"id eiusmod\",\n \"query\": \"ad\"\n },\n \"limit\": 100\n}"
}
}
}