Lookup API

Use the lookup endpoints to download, upload, and delete files that can be used by the match() function.

You can upload files in CSV or JSON format. Upload files as multipart form data. The file should be in a part named file.

Files can be uploaded to a repository or files can be uploaded as shared files that are available in all repositories. Uploading a file with the same name will replace the original file that was uploaded previously. Shared files are visible in all repositories and can be used by all users. Only root users can upload, delete and edit shared files. Shared files are referenced from functions like match(), by filename preprended with /shared/. For example /shared/myfile.csv

Download Files

LogScale enables you to download files that have been uploaded to it. For the GET form, this endpoint returns the document.

There is also a GraphQL query for this.

Description Download a file from a repository in the cluster.  
MethodGET /api/v1/repositories/repository/files/filename 
Authentication Requiredyes 
Path ArgumentsDescriptionData typeRequired?
filename Name of the file to download; must be .csv or .json. stringrequired
repository The repository name stringrequired
Return Codes 
200 Request complete  
400 Bad request  
500 Request failed  
http
GET /api/v1/repositories/repository/location/files/filename
Show:
shell
curl -v -X GET $YOUR_LOGSCALE_URL/api/v1/repositories/repository/location/files/$YOUR_FILE_NAME.json \
    -H "Authorization: Bearer $TOKEN" \
    -H "Content-Type: application/json"

Download Shared Files

LogScale enables you to download shared files that have been uploaded to it. For the GET form, this endpoint returns the document.

Description Download a shared file in the cluster.  
MethodGET /api/v1/uploadedfiles/shared/filename 
Authentication Requiredyes 
Path ArgumentsDescriptionData typeRequired?
filename Name of the file to download; must be .csv or .json. stringrequired
Return Codes 
200 Request complete  
400 Bad request  
500 Request failed  
http
GET /api/v1/uploadedfiles/shared/filename
Show:
shell
curl -v -X GET $YOUR_LOGSCALE_URL/api/v1/uploadedfiles/shared/$YOUR_FILE_NAME.json \
    -H "Authorization: Bearer $TOKEN" \
    -H "Content-Type: application/json"

Upload Files

LogScale enables you to upload files. The files must be JSON or CSV files.

Description Upload a file to a repository.  
MethodPOST /api/v1/repositories/repository/files 
Request Data  
Authentication Requiredyes 
Path ArgumentsDescriptionData typeRequired?
repository The repository name stringrequired
Return Codes 
200 Request complete  
400 Bad request  
500 Request failed  
http
POST api/v1/repositories/$REPOSITORY_NAME/files
Show:
shell
curl -v -X POST $YOUR_LOGSCALE_URL/api/v1/repositories/$REPOSITORY_NAME/files \
    -H "Authorization: Bearer $TOKEN" \
-F "file=@$YOUR_FILE_NAME.json

Upload Shared Files

If you are a self-hosted user, LogScale enables you to upload shared files. The files must be JSON or CSV files.

Description Upload a shared file to a repository.
MethodPOST /api/v1/uploadedfiles/shared
Request Data 
Authentication Requiredyes
Return Codes
200 Request complete
400 Bad request
500 Request failed
http
POST /api/v1/uploadedfiles/shared
Show:
shell
curl -v -X POST $YOUR_LOGSCALE_URL/api/v1/uploadedfiles/shared \
    -H "Authorization: Bearer $TOKEN" \
-F "file=@$YOUR_FILE_NAME.json

Delete Files

LogScale enables you to delete files that have been uploaded to it. For Cloud users, a file can be deleted from all repositories using the following:

Description Delete a file from a repository.  
MethodDELETE /api/v1/repositories/repository/files/filename 
Authentication Requiredyes 
Path ArgumentsDescriptionData typeRequired?
filename Name of the file to download; must be .csv or .json. stringrequired
repository The repository name stringrequired
Return Codes 
200 Request complete  
400 Bad request  
500 Request failed  
http
DELETE /api/v1/repositories/REPOSITORY_NAME/files/filename
Show:
shell
curl -v -X DELETE $YOUR_LOGSCALE_URL/api/v1/repositories/REPOSITORY_NAME/files/$YOUR_FILE_NAME.json \
    -H "Authorization: Bearer $TOKEN"

Delete Shared Files

LogScale enables you to delete shared files that have been uploaded to it. For self-hosted users, a file can be deleted from all repositories using the following:

Description Delete a shared file in a cluster.  
MethodDELETE /api/v1/uploadedfiles/shared/filename 
Authentication Requiredyes 
Path ArgumentsDescriptionData typeRequired?
filename Name of the file to download; must be .csv or .json. stringrequired
Return Codes 
200 Request complete  
400 Bad request  
500 Request failed  
http
DELETE /api/v1/uploadedfiles/shared/filename
Show:
shell
curl -v -X DELETE $YOUR_LOGSCALE_URL/api/v1/uploadedfiles/shared/$YOUR_FILE_NAME.json \
    -H "Authorization: Bearer $TOKEN"

Example Contents for a CSV File

Whitespace gets included in the keys and values. To include the separator "," in a value, quote using the " character.

csv
userid,name
1,chr
2,krab
"4","p,m"
7,mgr

Example: contents for a file in JSON format using an object as root of the file.

In this variant, the key field does not have a name.

json
{
  "1": { "name": "chr" },
  "2": { "name": "krab" },
  "4": { "name": "pmm" },
  "7": { "name": "mgr" }
}

Example: contents for a file in JSON format using an array as root of the file.

In this variant, you select which field is the key using the field parameter in match().

json
[
  { "userid": "1", "name": "chr" },
  { "userid": "2", "name": "krab" },
  { "userid": "4", "name": "pmm" },
  { "userid": "7", "name": "mgr" }
]