The Clinical API is used for managing patients, prescriptions and orders
Example
The easiest way to query the API is to use a library that supports graphql. The below example is using the GraphQL Request library
const graphQLClient = new GraphQLClient('https://api.photon.health/graphql', {
headers: {
authorization: 'AUTH TOKEN HERE',
},
});
const query = gql`
{
patients {
id
externalId
name {
full
}
}
}
`;
const results = await graphQLClient.request(query);
If you wanted to just use raw http requests, you could do something like the following
const axios = require('axios').default;
const data = JSON.stringify({
query: `query {
patients {
id
externalId
name {
full
}
}
}`,
variables: {}
});
const config = {
headers: {
'authorization': 'AUTH TOKEN HERE',
'content-type': 'application/json'
},
};
const results = await axios.post('https://api.photon.health/graphql', data, config);
The above example is using Axios to make the https request.