Skip to content

Instantly share code, notes, and snippets.

@regmicmahesh
Created October 3, 2023 11:36
Show Gist options
  • Save regmicmahesh/00d74e04af6123fb8f37d84b0f32fa67 to your computer and use it in GitHub Desktop.
Save regmicmahesh/00d74e04af6123fb8f37d84b0f32fa67 to your computer and use it in GitHub Desktop.
Interacting with Healthlake REST API
import axios from "axios";
import { aws4Interceptor } from "aws4-axios";
const DATASTORE_URL = "[REDACTED]";
const interceptor = aws4Interceptor({
options: {
region: "us-east-1",
service: "healthlake",
},
credentials: {
accessKeyId: process.env.AWS_ACCESS_KEY_ID!,
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY!,
},
});
axios.interceptors.request.use(interceptor);
axios
.get(
`${DATASTORE_URL}/Patient/faceab47-637e-4352-8736-cefa260057d3`,
)
.then((res) => {
console.log(res.data);
});
{
"name": "demo",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"aws4-axios": "^3.3.0",
"axios": "^1.5.1"
},
"devDependencies": {
"@types/node": "^20.8.2"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment