Upload a CSV file to the bucket. In this example, ip-dst_misp_example.csv ). You can upload it to wherever any location you want in the bucket. In the following example, it has been uploaded to a location we’ve uploaded it under the root folder of the bucket, in a folder called lookups_csv . Image RemovedImage AddedNavigate to the Objects tab inside your bucket and locate your CSV. Click it to display its properties. Get the Key and the key AWS Region of the CSV file by clicking the button in the Key section. Image Removedclicking on the button in the Key section. Image AddedGet or create an Access Key for your IAM User and obtain its Secret Key so the Lookups Manager can access your AWS Account. Create a JSON payload to be added to your lookup creation request to the API request. It must include a Source object without the which does not include a query attribute, but including the includes a fileProvider parameter one with the name of the bucket the bucket, the access key and the secret key of the AWS IAM User, the AWS region where the bucket has been created and the key of the file. For example: Code Block |
---|
{
"id": {
"creator": "lookups_domain",
"name": "IPsLookup"
},
"visibility": "creator-only",
"recipe": {
"recipeType": "once",
"source": {
"columns": [
{
"name": "ipAddr",
"from": 0,
"type": "IP4"
},
{
"name": "firstSeen",
"from": 1,
"type": "STRING"
},
{
"name": "lastSeen",
"from": 2,
"type": "STRING"
},
{
"name": "comment",
"from": 3,
"type": "STRING"
}
],
"skipPreface": null,
"hasHeader": true,
"skipEmptyLines": false,
"fileProvider": {
"bucketName": "devo-lookups-client1-stage",
"keyName": "lookups_csv/ip-dst_misp_example.csv.csv",
"accessKey": "abcdefghijkl",
"secretKey": "Tg4T0aGKvd/aaaaaaaWWQv3Vs0kS15tpn3kbd0V2UZ",
"region": "eu-west-1",
"transferOwnership": true
}
},
"lookupType": {
"type": "normal"
},
"append": false,
"key": {
"type": "column",
"column": "ipAddr"
},
"columnFilter": [
"ipAddr",
"firstSeen",
"lastSeen",
"comment"
],
"contribution": {
"type": "add"
},
"requiresDate": false
}
} |
Create a HTTP POST or PUT request with the created payload: Code Block |
---|
curl --location --request POST 'https://<devo-apis-host>/lookup-api/lookup/lookups_domain/IPsLookup/deploy-config' \
--header 'Authorization: Bearer <your-token>' \
--header 'Content-Type: application/json' \
--data-raw '{-raw '{
"id": {
"creator": "lookups_domain",
"name": "IPsLookup"
},
"visibility": "creator-only",
"idrecipe": {
"creatorrecipeType": "lookups_domainonce",
"namesource": {
"IPsLookup"columns": [
{
}, "visibilityname": "creator-only",ipAddr",
"recipefrom": {0,
"recipeType": "once", "sourcetype": {"IP4"
"columns": [ },
{
"name": "ipAddrfirstSeen",
"from": 01,
"type": "IP4STRING"
},
{
"name": "firstSeenlastSeen",
"from": 12,
"type": "STRING"
},
{
"name": "lastSeencomment",
"from": 23,
"type": "STRING"
},
],
{ "nameskipPreface": "comment",
null,
"fromhasHeader": 3true,
"typeskipEmptyLines": "STRING"false,
}"fileProvider": {
], "skipPrefacebucketName": null,"devo-lookups-client1-stage",
"hasHeaderkeyName": true, "lookups_csv/ip-dst_misp_example.csv",
"skipEmptyLinesaccessKey": false,
"fileProviderabcdefghijkl": {,
"bucketNamesecretKey": "devo-lookups-client1-stageTg4T0aGKvd/aaaaaaaWWQv3Vs0kS15tpn3kbd0V2UZ",
"keyNameregion": "lookups_csv/ip-dst_misp_example.csveu-west-1",
"transferOwnership": false
}
},
"lookupType": {
"type": "normal"
},
"append": false,
"key": {
"type": "column",
"column": "ipAddr"
},
"columnFilter": [
"ipAddr",
"firstSeen",
"lastSeen",
"comment"
],
"contribution": {
"type": "add"
},
"requiresDate": false
}
}' | rw-stepYou should get a successful response of the likes ofresponse similar to this: Code Block |
---|
{
"type": "LookupCreationResponse",
"cid": "65574b8c3463",
"code": 201,
"context": null,
"id": "baa1b1ef-6430-11ed-9fc0-efb84bae0957",
"msg": "Lookup sent to creation. You can check the lookup status using the provided id: /lookup/{domain}/{name}/job/{id}",
"lookupDeployConfig": {
"id": {
"creator": "lookups_domain",
"name": "IPsLookup"
},
"visibility": "creator-only",
"recipe": {
"recipeType": "once",
"source": {
"columns": [
{
"name": "ipAddr",
"from": 0,
"type": "IP4"
},
{
"name": "firstSeen",
"from": 1,
"type": "STRING"
},
{
"name": "lastSeen",
"from": 2,
"type": "STRING"
},
{
"name": "comment",
"from": 3,
"type": "STRING"
}
],
"skipPreface": null,
"hasHeader": true,
"skipEmptyLines": false,
"fileProvider": {
"hasHeader": true, "bucketName": "devo-lookups-client1-stage",
"skipEmptyLineskeyName": false,"lookups_csv/ip-dst_misp_example.csv",
"fileProvideraccessKey": {"abcdefghijkl",
"bucketNamesecretKey": "devo-lookups-client1-stageTg4T0aGKvd/aaaaaaaWWQv3Vs0kS15tpn3kbd0V2UZ",
"keyNameregion": "lookups_csv/ip-dst_misp_example.csveu-west-1",
"transferOwnership": false
},
"query": null
},
"lookupType": {
"type": "normal",
"instantPolicy": null,
"instant": null,
"columnName": null
},
"append": false,
"key": {
"columns": [],
"column": "ipAddr",
"type": "column"
},
"columnFilter": [
"ipAddr",
"firstSeen",
"lastSeen",
"comment"
],
"contribution": {
"type": "add",
"name": null
},
"secondaryIndexes": null,
"refreshMillis": null,
"startMillis": null,
"requiresDate": false
},
"notifyStatus": null
}
} |
You can check for the status state of the creation/update querying the /<domain>/<lookup>/job/<id> . If and if you see the message Lookup ready to be executed , you can start using the lookup. Code Block |
---|
curl --location --request GET 'https://<devo-apis-host>/lookup-api/lookup/lookups_domain/IPsLookup/job/baa1b1ef-6430-11ed-9fc0-efb84bae0957' \
--header 'Authorization: Bearer <your-token>'
{
"type": "LookupJobListResponseLookupJobStagesListResponse",
"cid": "b5c3f2981537",
"code": 200,
"context": null,
"id": "47c2b160-6431-11ed-9fc0-cd58ebae0bc3",
"msg": "Lookup jobs",
"jobs": [
{
"eventdate": "2022-11-14T15:26:49.14",
"domain": "lookups_domain",
"lookup": "IPsLookup",
"msg": "Lookup successfully created"
"code": "create.ok"
},
{
"eventdate": "2022-11-14T15:27:11.767",
"domain": "lookups_domain",
"lookup": "IPsLookup",
"msg": "Lookup ready to be executed"
"code": "deploy.ok"
}
],
"nextPageToken": 1668439608968
} |
|