Skip to content

TH_API 2.0 API Endpoints

Nia Mutiara edited this page Feb 28, 2014 · 2 revisions

Hostname: tradehero.mobi

News

Countries and Categories

  • Categories: GET /api/news/categories
  • Countries: GET /api/news/countries -> country code and language code pair to be used for filtering regional news

Filtering

  • Worldwide: GET /api/news/global
  • Country-specific: GET /api/news/regional with params countryCode=<country_code> and languageCode=<language_code>
  • My Headlines: GET /api/news/ofinterest
  • From social media: GET /api/news/social with params categoryId=<category_id>

News Details

GET /api/news/<news_id>

Discussions & comments

Summary

Creating:

POST /api/discussions with params 
    text=<discussion_text>
    inReplyToType=replyableType
    inReplyToId=replyableId
    isPublic=<1/0>
    publishToFb=<1/0>
    publishToTw=<1/0>
    publishToLi=<1/0>
    geo_alt=<altitude>
    geo_lat=<latitude>
    geo_long=<longitude>

Fetching replies:

GET /api/discussions/<replyable_type>/<replyable_id>

Voting:

POST /api/discussions/<replyable_type>/<replyable_id>/vote/<vote_direction>

Sharing:

POST /api/discussions/<replyable_type>/<replyable_id>/share with params socialNetwork = FB|TW|LI

Details

  • Timeline Item (on Profile Screen)
    • List replies of a timeline item: GET /api/discussions/timelineitem/<tli_id>
    • Vote up: POST /api/discussions/timelineitem/<tli_id>/vote/up
    • Cancel voting: POST /api/discussions/timelineitem/<tli_id>/vote/cancel
    • Sharing: see above
  • Security (on Security Screen)
    • List discussions of a security: GET /api/discussions/security/<security_id>
    • Vote up: POST /api/discussions/security/<tli_id>/vote/up
    • Cancel voting: POST /api/discussions/security/<tli_id>/vote/cancel
    • Sharing: see above
  • News (on News details Screen)
    • List discussions of a news: GET /api/discussions/news/<news_id>
    • Vote up: POST /api/discussions/news/<tli_id>/vote/up
    • Cancel voting: POST /api/discussions/news/<tli_id>/vote/cancel
    • Sharing: see above
  • Replies of a discussion/reply
    • List discussions of a discussion/reply: GET /api/discussions/comment/<comment_id>
    • Vote up: POST /api/discussions/comment/<tli_id>/vote/up
    • Cancel voting: POST /api/discussions/comment/<tli_id>/vote/cancel
    • Sharing: see above

To be confirmed

  • Voice clips & image uploads
  • Private messaging
  • Push notifications whenever a “subscribed” comment thread is updated

Bing Translations

Test account client ID and secret:

#define BING_CLIENT_ID @"12375812376439443957334"
#define BING_SECRET @"PG+2hpZdOYfv7pRRB2YJO+4v4k1+iuh/2bzeg+AurMk="

Bing translate API authentication uses 2-legged OAuth. Get access token first before doing translation requests. The access token has a couple of mins expiry, so actually it can be reused for a while

To get an access token

POST https://datamarket.accesscontrol.windows.net/v2/OAuth2-13 with body params
    scope=http://api.microsofttranslator.com
    grant_type=client_credentials
    client_id=<BING_CLIENT_ID>
    client_secret=<BING_SECRET>

To fetch translation

GET http://api.microsofttranslator.com/v2/Http.svc/Translate with header
    Authorization: Bearer <access_token>
    and params
    from=<from_language_code>
    to=<to_language_code>
    contentType="text/plain"
    text=<text_to_translate>

Landscape chart needs an extra param to include the volumes. Reuters: lowers=volume Yahoo: a=v

Clone this wiki locally