Skip to content

Latest commit

 

History

History
23 lines (19 loc) · 10.2 KB

File metadata and controls

23 lines (19 loc) · 10.2 KB

Endpoints and routes related to the twitter demo

Endpoint HTTP method Requires auth? Description Returned data Requested data format
/load_twitter_data/ GET no Load all tweets and analysis results for main feed. 200 OK {'tweets': <tweets>} on success, where <tweets> is a list of lists and each inner list has exactly two elements: [0] tweet object (as crawled) and [1] analysis results
444 Bad Request else
none
/load_tweets_user/ POST no Load timeline tweets of a specific user. 200 OK {'tweets': <tweets>} on success, where <tweets> is a list of tweet object (as crawled)
400 Missing Arg if no user-id is passed to the endpoint.
444 Bad Request else
{'user_id': <user_id>} as string
/load_tweets_topic/ POST no Load tweets related to a specific topic. 200 OK {'tweets': <tweets>} on success, where <tweets> is a list of tweet object (as crawled)
400 Missing Arg if no topic is passed to the endpoint.
444 Bad Request else
{'topic': <topic>} as string (optional: 'n': <num_tweets>)
/load_user_following_data/ POST no Load user ids of accounts a specific user if following. 200 OK {'following': [<user_ids>]} on success where <user_ids> are all user ids of accounts this user is following (related to number of following information crawled for this user)
400 Missing Arg if no user-id is passed to the endpoint.
444 Bad Request else
{'user_id': <user_id>} as string`)
/analyze_twitter_data/ GET no Run analysis algorithms on available tweets. 200 OK {'status': 'SUCCESSFUL'} on success (analysis results are saved on the server)
444 Bad Request else
none
/load_algorithm_results/ POST no Get prediction samples of a specific algorithm (algorithm overview page). 200 OK {'predictions': <file_content>} on success, where <file_content> is a list of list and each inner list contains one sample (text, true label, predicted label)
400 Missing Arg if no file name is passed to the endpoint.
444 Bad Request else
{'file_name': <file_name>} as string
/load_user_tweets_analysis/ POST no Load analysis results of a user's tweets. 200 OK {'sentiment': {'negative': <neg>, 'neutral': <neu>, 'positive': <pos>}, 'emotion': {'sadness': <sad>, 'anger': <ang>, 'joy': <joy>, 'optimism': <opt>}} on success, where all values in <> are floats representing the probability of the respective label
400 Missing Arg if no user-id is passed to the endpoint.
444 Bad Request else
{'user_id': <user_id>} as string
/crawl_new_data/ GET no Run crawling process to (1) get home feed posts, (2) user timeline posts and (3) topic posts. 200 OK {'status': 'SUCCESSFUL'} on success (crawled twitter data are saved on the server)
444 Bad Request else
none

Endpoints and routes related to the language specific twitter demo

Endpoint HTTP method Requires auth? Description Returned data Requested data format
/load_topic_data_EXP/ POST no Load tweets on specific topic for language specific demo page. 200 OK {'tweets': [<tweets>], 'analysis': [<analysis>]} on success where <tweets> are all tweet objects realted to this topic and <analysis> are all analysis objects generated for the respective tweets
400 Missing Arg if no topic name is passed to the endpoint.
444 Bad Request else
{'topic': <topic>} as string (optional: 'n': <num_tweets>; 'lang': <lang> one out of ['it', 'en], default is 'it')
/load_user_data_EXP/ POST no Load tweets of specific user for language specific demo page. 200 OK {'tweets': [<tweets>], 'analysis': [<analysis>]} on success where <tweets> are all tweet objects realted to this user and <analysis> is exactly one analysis object generated for all respective tweets
400 Missing Arg if no user-id is passed to the endpoint.
444 Bad Request else
{'user_id': <user_id>} as string (optional: 'lang': <lang> one out of ['it', 'en], default is 'it')
/load_user_following_data_EXP/ POST no Load user ids of accounts a specific user if following (language specific demo page). 200 OK {'following': [<user_ids>]} on success where <user_ids> are all user ids of accounts this user is following (related to number of following information crawled for this user)
400 Missing Arg if no user-id is passed to the endpoint.
444 Bad Request else
{'user_id': <user_id>} as string (optional: 'lang': <lang> one out of ['it', 'en], default is 'it')
/crawl_new_data_IT/ POST no Crawl new data for Italian Twitter demo to (1) get tweets on specific topics and (2) user timeline tweets. 200 OK {'status': 'SUCCESSFUL'} on success (crawled twitter data are saved on the server)
444 Bad Request {'status': 'ERROR'} else
{} as string (optional: 'topics': [<topics>] as a list of topic names; 'clear': <clear> boolean if existing data should be deleted)
/analyze_twitter_data_IT/ GET no Run analysis algorithms on available Italian demo tweets. 200 OK {'status': 'SUCCESSFUL'} on success (analysis results are saved on the server)
444 Bad Request {'status': 'ERROR'} else
none