Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Rw ui steps macro
Rw step

Locate your Lookup Manager AWS user. For the US, use the following:

arn:aws:iam::175688291360:user/devo-lookups-prod-us

Rw step

Make sure you have access to an S3 bucket in the same AWS region as the Lookup Manager and write down its name. For example lookups-bucket

Rw step

Apply a policy to the bucket which grants the s3:GetObject, the s3:PutObject, and the s3:DeleteObject permissions to the Lookup Manager AWS user in your bucket so that it has permission to download and delete objects from it. See some examples of these policies on the AWS docs.

Rw step

Upload the required CSV file to the bucket, for example, lookup-data.csv. You can upload it to any location you want in the bucket.

Rw step

Get the CSV file S3 URI. You can access the bucket on the AWS console web page using the button Copy S3 URI. This way, you will get a URI that looks like this: s3://lookups-bucket/lookup-data.csv.

Image RemovedImage Added
Rw step

Get the object key from that URI. The structure of the S3 URI is like the following: s3://<bucket-name>/<object-key>. In this case, our key would be lookup-data.csv.

Rw step

Create a JSON payload to add to a request to the API with a Source object which does not include a query attribute; instead, include the fileProvider parameter with the name of the bucket and the key of the file. For example:

Code Block
{
  "id": {
    "creator": "lookups_domain",
    "name": "LocationsLookup"
  },
  "visibility": "creator-only",
  "recipe": {
    "recipeType": "once",
    "source": {
      "columns": [
        {
          "name": "ID",
          "from": 0,
          "type": "INT4"
        },
        {
          "name": "Location",
          "from": 1,
          "type": "STRING"
        }
      ],
      "skipPreface": null,
      "hasHeader": false,
      "skipEmptyLines": false,
      "fileProvider": {
        "bucketName": "lookups-bucket",
        "keyName": "lookup-data.csv",
        "transferOwnership": true
      }
    },
    "lookupType": {
      "type": "normal"
    },
    "append": false,
    "key": {
      "type": "column",
      "column": "ID"
    },
    "columnFilter": [
      "ID",
      "Location"
    ],
    "contribution": {
      "type": "add"
    },
    "requiresDate": false
  }
}
Rw step

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/LocationsLookup/deploy-config' \
--header 'Authorization: Bearer <your-token>' \
--header 'Content-Type: application/json' \
--data-raw '{
  "id": {
    "creator": "lookups_domain",
    "name": "LocationsLookup"
  },
  "visibility": "creator-only",
  "recipe": {
    "recipeType": "once",
    "source": {
      "columns": [
        {
          "name": "ID",
          "from": 0,
          "type": "INT4"
        },
        {
          "name": "Location",
          "from": 1,
          "type": "STRING"
        }
      ],
      "skipPreface": null,
      "hasHeader": false,
      "skipEmptyLines": false,
      "fileProvider": {
        "bucketName": "lookups-bucket",
        "keyName": "lookup-data.csv",
        "transferOwnership": true
      }
    },
    "lookupType": {
      "type": "normal"
    },
    "append": false,
    "key": {
      "type": "column",
      "column": "ID"
    },
    "columnFilter": [
      "ID",
      "Location"
    ],
    "contribution": {
      "type": "add"
    },
    "requiresDate": false
  }
}

You should get a successful response of the likes of:

Code Block
{
    "type": "LookupCreationResponse",
    "cid": "ba9ac1c28205",
    "code": 201,
    "context": null,
    "id": "46a68695-543d-11ed-b24b-b102fd5ab44d",
    "msg": "Lookup sent to creation",
    "lookupDeployConfig": {
        "id": {
            "creator": "lookups_domain",
            "name": "LocationsLookup"
        },
        "visibility": "creator-only",
        "recipe": {
            "recipeType": "once",
            "source": {
                "columns": [
                    {
                        "name": "ID",
                        "from": 0,
                        "type": "INT4"
                    },
                    {
                        "name": "Location",
                        "from": 1,
                        "type": "STRING"
                    }
                ],
                "skipPreface": null,
                "hasHeader": false,
                "skipEmptyLines": false,
                "fileProvider": {
                    "bucketName": "lookups-bucket",
                    "keyName": "lookup-data.csv",
                    "transferOwnership": true
                },
                "query": null
            },
            "lookupType": {
                "type": "normal",
                "instantPolicy": null,
                "instant": null,
                "columnName": null
            },
            "append": false,
            "key": {
                "columns": [],
                "column": "ID",
                "type": "column"
            },
            "columnFilter": [
                "ID",
                "Location"
            ],
            "contribution": {
                "type": "add",
                "name": null
            },
            "secondaryIndexes": null,
            "refreshMillis": null,
            "startMillis": null,
            "requiresDate": false
        },
        "notifyStatus": null
    }
}
Rw step

You can check the status of the lookup creation/update querying /<domain>/<lookup>/job/<id> You can start using the lookup once you see the message Lookup ready to be executed.

Code Block
curl --location --request GET 'https://<devo-apis-host>/lookup-api/lookup/lookups_domain/LocationsLookup/job/46a68695-543d-11ed-b24b-b102fd5ab44d' \
--header 'Authorization: Bearer <your-token>'
{
    "type": "LookupJobListResponse",
    "cid": "9aaa3cd93327",
    "code": 200,
    "context": null,
    "id": "ee2bd9f6-543e-11ed-b24b-9bb4e40c2d97",
    "msg": "Lookup jobs",
    "jobs": [
        {
            "eventdate": "2022-10-24T12:31:36.934",
            "domain": "lookups_domain",
            "lookup": "LocationsLookup",
            "msg": "Lookup successfully created"
        },
        {
            "eventdate": "2022-10-24T12:32:07.294",
            "domain": "lookups_domains",
            "lookup": "LocationsLookup",
            "msg": "Lookup ready to be executed"
        }
    ],
    "nextPageToken": 1666614696608
}

...