PageRenderTime 22ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/articles/connectors/connectors-create-api-twitter.md

https://gitlab.com/yeah568/azure-content
Markdown | 326 lines | 248 code | 78 blank | 0 comment | 0 complexity | 5d0585625aa3123e714d42ccd22a1cc6 MD5 | raw file
  1. <properties
  2. pageTitle="Add the Twitter connector in PowerApps Enterprise and Logic Apps | Microsoft Azure"
  3. description="Overview of Twitter connector with REST API parameters"
  4. services=""
  5. documentationCenter=""
  6. authors="MandiOhlinger"
  7. manager="erikre"
  8. editor=""
  9. tags="connectors"/>
  10. <tags
  11. ms.service="multiple"
  12. ms.devlang="na"
  13. ms.topic="article"
  14. ms.tgt_pltfrm="na"
  15. ms.workload="na"
  16. ms.date="05/18/2016"
  17. ms.author="mandia"/>
  18. # Get started with the Twitter connector
  19. Connect to Twitter to post a tweet, get a user's timeline, and more. The Twitter connector can be used from:
  20. - Logic apps
  21. - PowerApps
  22. > [AZURE.SELECTOR]
  23. - [Logic apps](../articles/connectors/connectors-create-api-twitter.md)
  24. - [PowerApps Enterprise](../articles/power-apps/powerapps-create-api-twitter.md)
  25. &nbsp;
  26. >[AZURE.NOTE] This version of the article applies to logic apps 2015-08-01-preview schema version.
  27. With Twitter, you can:
  28. - Build your business flow based on the data you get from Twitter.
  29. - Use triggers for when there is a new tweet.
  30. - Use actions to post a tweet, search tweets, and more. These actions get a response, and then make the output available for other actions. For example, when a new tweet appears, you can post this tweet on Facebook.
  31. - Add the Twitter connector to PowerApps Enterprise. Then, your users can use this connector within their apps.
  32. For information on how to add connector in PowerApps Enterprise, go to [Register connector in PowerApps](../power-apps/powerapps-register-from-available-apis.md).
  33. To add an operation in logic apps, see [Create a logic app](../app-service-logic/app-service-logic-create-a-logic-app.md).
  34. ## Triggers and actions
  35. Twitter includes the following trigger and actions.
  36. Trigger | Actions
  37. --- | ---
  38. <ul><li>When a new tweet appears</li></ul>| <ul><li>Post a new tweet</li><li>When a new tweet appears</li><li>Get home timeline</li><li>Get user</li><li>Get user timeline</li><li>Search tweet</li><li>Get followers</li><li>Get my followers</li><li>Get following</li><li>Get my following</li></ul>
  39. All connectors support data in JSON and XML formats.
  40. ## Create the connection to Twitter
  41. When you add this connector to your logic apps, you must authorize logic apps to connect to your Twitter account.
  42. 1. Sign in to your Twitter account.
  43. 2. Select **Authorize**, and allow your logic apps to connect and use your Twitter account.
  44. >[AZURE.INCLUDE [Steps to create a connection to Twitter](../../includes/connectors-create-api-twitter.md)]
  45. >[AZURE.TIP] You can use this same Twitter connection in other logic apps.
  46. ## Swagger REST API reference
  47. Applies to version: 1.0.
  48. ### Post a new tweet
  49. Tweet.
  50. ```POST: /posttweet```
  51. | Name| Data Type|Required|Located In|Default Value|Description|
  52. | ---|---|---|---|---|---|
  53. |tweetText|string|no|query|none|Text to be posted|
  54. |body| string (binary) |no|body|none|Media to be posted|
  55. #### Response
  56. |Name|Description|
  57. |---|---|
  58. |200|OK|
  59. |400|Bad Request|
  60. |401|Unauthorized|
  61. |403|Forbidden|
  62. |404|Not Found|
  63. |500|Internal Server Error. Unknown error occured|
  64. |default|Operation Failed.|
  65. ### When a new tweet appears
  66. Triggers a workflow when a new tweet is posted which matches your search query.
  67. ```GET: /onnewtweet```
  68. | Name| Data Type|Required|Located In|Default Value|Description|
  69. | ---|---|---|---|---|---|
  70. |searchQuery|string|yes|query|none|Query text (you may use any Twitter supported query operators: http://www.twitter.com/search)|
  71. #### Response
  72. |Name|Description|
  73. |---|---|
  74. |200|OK|
  75. |202|Accepted|
  76. |400|Bad Request|
  77. |401|Unauthorized|
  78. |403|Forbidden|
  79. |404|Not Found|
  80. |500|Internal Server Error. Unknown error occured|
  81. |default|Operation Failed.|
  82. ### Get home timeline
  83. Retrieves the most recent tweets and re-tweets posted me and my followers.
  84. ```GET: /hometimeline```
  85. | Name| Data Type|Required|Located In|Default Value|Description|
  86. | ---|---|---|---|---|---|
  87. |maxResults|integer|no|query|20|Maximum number of tweets to retrieve|
  88. #### Response
  89. |Name|Description|
  90. |---|---|
  91. |200|OK|
  92. |400|Bad Request|
  93. |401|Unauthorized|
  94. |403|Forbidden|
  95. |404|Not Found|
  96. |500|Internal Server Error. Unknown error occured|
  97. |default|Operation Failed.|
  98. ### Get user
  99. Retrieves details about the specified user (example: user name, description, followers count, etc.).
  100. ```GET: /user```
  101. | Name| Data Type|Required|Located In|Default Value|Description|
  102. | ---|---|---|---|---|---|
  103. |userName|string|yes|query|none|Twitter handle of the user|
  104. #### Response
  105. |Name|Description|
  106. |---|---|
  107. |200|OK|
  108. |400|Bad Request|
  109. |401|Unauthorized|
  110. |403|Forbidden|
  111. |404|Not Found|
  112. |500|Internal Server Error. Unknown error occured|
  113. |default|Operation Failed.|
  114. ### Get user timeline
  115. Retrieves a collection of the most recent tweets posted by the specified user.
  116. ```GET: /usertimeline```
  117. | Name| Data Type|Required|Located In|Default Value|Description|
  118. | ---|---|---|---|---|---|
  119. |userName|string|yes|query|none|Twitter handle|
  120. |maxResults|integer|no|query|20|Maximum number of tweets to retrieve|
  121. #### Response
  122. |Name|Description|
  123. |---|---|
  124. |200|OK|
  125. |400|Bad Request|
  126. |401|Unauthorized|
  127. |403|Forbidden|
  128. |404|Not Found|
  129. |500|Internal Server Error. Unknown error occured|
  130. |default|Operation Failed.|
  131. ### Search tweet
  132. Retrieves a collection of relevant tweets matching a specified query.
  133. ```GET: /searchtweets```
  134. | Name| Data Type|Required|Located In|Default Value|Description|
  135. | ---|---|---|---|---|---|
  136. |searchQuery|string|yes|query|none|Query text (you may use any Twitter supported query operators: http://www.twitter.com/search)|
  137. |maxResults|integer|no|query|20|Maximum number of tweets to retrieve|
  138. #### Response
  139. |Name|Description|
  140. |---|---|
  141. |200|OK|
  142. |400|Bad Request|
  143. |401|Unauthorized|
  144. |403|Forbidden|
  145. |404|Not Found|
  146. |500|Internal Server Error. Unknown error occured|
  147. |default|Operation Failed.|
  148. ### Get followers
  149. Retrieves users following the specified user.
  150. ```GET: /followers```
  151. | Name| Data Type|Required|Located In|Default Value|Description|
  152. | ---|---|---|---|---|---|
  153. |userName|string|yes|query|none|Twitter handle of the user|
  154. |maxResults|integer|no|query|20|Maximum number of users to retrieve|
  155. #### Response
  156. |Name|Description|
  157. |---|---|
  158. |200|OK|
  159. |400|Bad Request|
  160. |401|Unauthorized|
  161. |403|Forbidden|
  162. |404|Not Found|
  163. |500|Internal Server Error. Unknown error occured|
  164. |default|Operation Failed.|
  165. ### Get my followers
  166. Retrieves users who are following me.
  167. ```GET: /myfollowers```
  168. | Name| Data Type|Required|Located In|Default Value|Description|
  169. | ---|---|---|---|---|---|
  170. |maxResults|integer|no|query|20|Maximum number of users to retrieve|
  171. #### Response
  172. |Name|Description|
  173. |---|---|
  174. |200|OK|
  175. |400|Bad Request|
  176. |401|Unauthorized|
  177. |403|Forbidden|
  178. |404|Not Found|
  179. |500|Internal Server Error. Unknown error occured|
  180. |default|Operation Failed.|
  181. ### Get following
  182. Retrieves users who the specified user is following.
  183. ```GET: /friends```
  184. | Name| Data Type|Required|Located In|Default Value|Description|
  185. | ---|---|---|---|---|---|
  186. |userName|string|yes|query|none|Twitter handle of the user|
  187. |maxResults|integer|no|query|20|Maximum number of users to retrieve|
  188. #### Response
  189. |Name|Description|
  190. |---|---|
  191. |200|OK|
  192. |400|Bad Request|
  193. |401|Unauthorized|
  194. |403|Forbidden|
  195. |404|Not Found|
  196. |500|Internal Server Error. Unknown error occured|
  197. |default|Operation Failed.|
  198. ### Get my following
  199. Retrieves users that I am following.
  200. ```GET: /myfriends```
  201. | Name| Data Type|Required|Located In|Default Value|Description|
  202. | ---|---|---|---|---|---|
  203. |maxResults|integer|no|query|20|Maximum number of users to retrieve|
  204. #### Response
  205. |Name|Description|
  206. |---|---|
  207. |200|OK|
  208. |400|Bad Request|
  209. |401|Unauthorized|
  210. |403|Forbidden|
  211. |404|Not Found|
  212. |500|Internal Server Error. Unknown error occured|
  213. |default|Operation Failed.|
  214. ## Object definitions
  215. ### TweetModel: representation of tweet object
  216. | Property Name | Data Type | Required |
  217. |---|---| --- |
  218. |TweetText|string|yes|
  219. |TweetId|string|no|
  220. |CreatedAt|string|no|
  221. |RetweetCount|integer|yes|
  222. |TweetedBy|string|yes|
  223. |MediaUrls|array|no|
  224. ### UserDetailsModel: representation of a Twitter user's details
  225. |Property Name | Data Type | Required |
  226. |---|---|---|
  227. |FullName|string|yes|
  228. |Location|string|yes|
  229. |Id|integer|no|
  230. |UserName|string|yes|
  231. |FollowersCount|integer|no|
  232. |Description|string|yes|
  233. |StatusesCount|integer|no|
  234. |FriendsCount|integer|no|
  235. ### TweetResponseModel: model representing posted tweet
  236. | Name | Data Type | Required |
  237. |---|---|---|
  238. |TweetId|string|yes|
  239. ### TriggerBatchResponse[TweetModel]
  240. |Property Name | Data Type |Required |
  241. |---|---|---|
  242. |value|array|no|
  243. ## Next steps
  244. [Create a logic app](../app-service-logic/app-service-logic-create-a-logic-app.md).
  245. Go back to the [APIs list](apis-list.md).
  246. <!--References-->
  247. [6]: ./media/connectors-create-api-twitter/twitter-apps-page.png
  248. [7]: ./media/connectors-create-api-twitter/twitter-app-create.png