I need a POST method usage example

33 views
Skip to first unread message

yasko....@pdffiller.team

unread,
Feb 20, 2019, 8:55:34 AM2/20/19
to Dandelion Support Forum
As I said, I need a POST method usage example.

I need my text to be analyzed by Entity Extraction API.

What endpoint should I use and what (in which format) should be presented in the request body?

Please advise.

The combination of : https://api.dandelion.eu/datatxt/nex/v1/?text&lang=en&min_confidence=0.6&include=image%2Cabstract%2Ctypes%2Ccategories%2Clod&social=False&top_entities=10&country=-1&token=[TOKEN] + {"text":"Some text about apples"} is not working...

Yakov Keselman

unread,
Feb 20, 2019, 1:30:51 PM2/20/19
to Dandelion Support Forum
I've been using Dandelion with entity extraction from Python. The following code should work assuming you have dandelion Python package installed (pip install dandelion). I believe it uses "POST" underneath: https://github.com/SpazioDati/python-dandelion-eu/blob/master/dandelion/base.py

import json
from dandelion import DataTXT

text = "some text"

_DL_TOKEN = getenv('DANDELION_AUTH_TOKEN')

datatxt = DataTXT(app_id=_DL_TOKEN, app_key=_DL_TOKEN)
response = datatxt.nex(text, min_confidence=0.8, include=['types', 'categories'])
print(json.dumps(response.annotations, indent=2))

ber...@dandelion.eu

unread,
Feb 28, 2019, 5:00:54 AM2/28/19
to Dandelion Support Forum
Hi Yasko,
the request body must be in application/x-www-form-urlencoded format, so you don't have to send a json but, e.g.:

lang=en&text=The%20doctor%20says%20an%20apple%20is%20better%20than%20an%20orange &include=types%2Cabstract%2Ccategories%2Clod

Regards
Giacomo Berardi
Dandelion Team

ber...@dandelion.eu

unread,
Feb 28, 2019, 5:02:04 AM2/28/19
to Dandelion Support Forum
Hi Yakov,
can you please open another thread and give more details about the error you receive?

Cheers
Giacomo Berardi
Dandelion Team
Reply all
Reply to author
Forward
0 new messages