SQL Server / Twitter API v2 / User's pinned Lists
Back to Collection Items
-- Important: See this note about string length limitations for strings returned by sp_OAMethod calls.
--
CREATE PROCEDURE ChilkatSample
AS
BEGIN
DECLARE @hr int
DECLARE @iTmp0 int
-- Important: Do not use nvarchar(max). See the warning about using nvarchar(max).
DECLARE @sTmp0 nvarchar(4000)
-- This example assumes the Chilkat API to have been previously unlocked.
-- See Global Unlock Sample for sample code.
DECLARE @http int
-- Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
EXEC @hr = sp_OACreate 'Chilkat.Http', @http OUT
IF @hr <> 0
BEGIN
PRINT 'Failed to create ActiveX component'
RETURN
END
DECLARE @success int
-- Adds the "Authorization: Bearer <access_token>" header.
EXEC sp_OASetProperty @http, 'AuthToken', '<access_token>'
DECLARE @sbResponseBody int
-- Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0
EXEC @hr = sp_OACreate 'Chilkat.StringBuilder', @sbResponseBody OUT
EXEC sp_OAMethod @http, 'QuickGetSb', @success OUT, 'https://api.twitter.com/2/users/:id/pinned_lists', @sbResponseBody
IF @success = 0
BEGIN
EXEC sp_OAGetProperty @http, 'LastErrorText', @sTmp0 OUT
PRINT @sTmp0
EXEC @hr = sp_OADestroy @http
EXEC @hr = sp_OADestroy @sbResponseBody
RETURN
END
EXEC sp_OAGetProperty @http, 'LastStatus', @iTmp0 OUT
PRINT 'Response status code = ' + @iTmp0
EXEC sp_OAMethod @sbResponseBody, 'GetAsString', @sTmp0 OUT
PRINT @sTmp0
EXEC @hr = sp_OADestroy @http
EXEC @hr = sp_OADestroy @sbResponseBody
END
GO
Curl Command
curl -X GET
-H "Authorization: Bearer <access_token>"
https://api.twitter.com/2/users/:id/pinned_lists
Postman Collection Item JSON
{
"name": "User's pinned Lists",
"event": [
{
"listen": "prerequest",
"script": {
"exec": [
""
],
"type": "text/javascript"
}
}
],
"protocolProfileBehavior": {
"disableBodyPruning": true
},
"request": {
"method": "GET",
"header": [
{
"key": "",
"value": "",
"type": "text",
"disabled": true
}
],
"body": {
"mode": "formdata",
"formdata": [
]
},
"url": {
"raw": "https://api.twitter.com/2/users/:id/pinned_lists",
"protocol": "https",
"host": [
"api",
"twitter",
"com"
],
"path": [
"2",
"users",
":id",
"pinned_lists"
],
"query": [
{
"key": "list.fields",
"value": "",
"description": "Comma-separated fields for the List object.\nAllowed values:\ncreated_at, follower_count, member_count, private, description, owner_id\nDefault values:\nid,name",
"disabled": true
},
{
"key": "expansions",
"value": "",
"description": "Expansions enable requests to expand an ID into a full object in the includes response object.\nAllowed value:\nowner_id\nDefault value: none",
"disabled": true
},
{
"key": "user.fields",
"value": "",
"description": "Comma-separated list of fields for the User object. Expansion required.\nAllowed values:\ncreated_at, description, entities, id, location, name, pinned_tweet_id, profile_image_url, protected, public_metrics, url, username, verified, withheld\nDefault values:\nid,name,username",
"disabled": true
}
],
"variable": [
{
"key": "id",
"value": "",
"description": "Required. The user ID whose pinned Lists you would like to retrieve. The user’s ID must correspond to the user ID of the authenticating user, meaning that you must pass the Access Tokens associated with the user ID when authenticating your request."
}
]
},
"description": "This endpoint returns details on a user's pinned Lists specified by the requested ID\n\nFor full details, see the [API reference](https://developer.twitter.com/en/docs/twitter-api/lists/pinned-lists/api-reference/get-users-id-pinned_lists) for this endpoint.\n\n[Sign up](https://t.co/signup) for the Twitter API"
},
"response": [
]
}