adverse-sapphire•16mo ago
Medline
Hi
I am looking to provide a mechanism in my vf assistant to retrieve XML responses from the Medline web service. A query like 'https://wsearch.nlm.nih.gov/ws/query?db=healthTopics&term=asthma' returns an XML page with the data (health topic search). Not sure how best to implement this as there is no API per se.
Any ideas would be greatly appreciated.
Thanks.
2 Replies
To retrieve XML responses from the Medline web service in your Voiceflow assistant, you can use the API integration block to make HTTP requests and handle the XML response. Here’s a step-by-step guide:
1. Add an API Integration Block:
- Drag and drop an API block into your Voiceflow project.
2. Configure the API Request:
- Set the method to
GET
.
- Enter the URL: https://wsearch.nlm.nih.gov/ws/query?db=healthTopics&term=asthma
.
- You can replace asthma
with a variable if you want to make the term dynamic.
3. Handle the XML Response:
- Since the response is in XML, you’ll need to parse it. Voiceflow’s API block supports JSON natively, so you might need to use a third-party service or a custom code block to convert XML to JSON.
- Alternatively, you can use an external service like Zapier or Integromat to handle the conversion and then send the JSON back to Voiceflow.
4. Extract Data from the Response:
- Once you have the response in JSON format, use Voiceflow’s variables to store and manipulate the data.
- You can then use these variables to create dynamic responses in your assistant.
Here’s an example of how you might set up the API block:
- Method: GET
- URL: https://wsearch.nlm.nih.gov/ws/query?db=healthTopics&term={term}
- Headers: (if needed, usually not required for this endpoint)
- Response Handling: Use a custom code block or external service to convert XML to JSON.
By following these steps, you can integrate the Medline web service into your Voiceflow assistant and handle XML responses effectively.adverse-sapphireOP•16mo ago
Tico - Explain point 3