Classic ASP / Twitter API v2 / Update a list
Back to Collection Items
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
' This example assumes the Chilkat API to have been previously unlocked.
' See Global Unlock Sample for sample code.
' For versions of Chilkat < 10.0.0, use CreateObject("Chilkat_9_5_0.Http")
set http = Server.CreateObject("Chilkat.Http")
' Use this online tool to generate code from sample JSON: Generate Code to Create JSON
' The following JSON is sent in the request body.
' {
' "name": "update-name",
' "description": "update-description",
' "private": false
' }
' For versions of Chilkat < 10.0.0, use CreateObject("Chilkat_9_5_0.JsonObject")
set json = Server.CreateObject("Chilkat.JsonObject")
success = json.UpdateString("name","update-name")
success = json.UpdateString("description","update-description")
success = json.UpdateBool("private",0)
' Adds the "Authorization: Bearer <access_token>" header.
http.AuthToken = "<access_token>"
' For versions of Chilkat < 10.0.0, use CreateObject("Chilkat_9_5_0.StringBuilder")
set sbRequestBody = Server.CreateObject("Chilkat.StringBuilder")
success = json.EmitSb(sbRequestBody)
' resp is a Chilkat.HttpResponse
Set resp = http.PTextSb("PUT","https://api.twitter.com/2/lists/:id",sbRequestBody,"utf-8","application/json",0,0)
If (http.LastMethodSuccess = 0) Then
Response.Write "<pre>" & Server.HTMLEncode( http.LastErrorText) & "</pre>"
Response.End
End If
Response.Write "<pre>" & Server.HTMLEncode( resp.StatusCode) & "</pre>"
Response.Write "<pre>" & Server.HTMLEncode( resp.BodyStr) & "</pre>"
%>
</body>
</html>
Curl Command
curl -X PUT
-H "Authorization: Bearer <access_token>"
-d '{
"name": "update-name",
"description": "update-description",
"private": false
}'
https://api.twitter.com/2/lists/:id
Postman Collection Item JSON
{
"name": "Update a list",
"request": {
"method": "PUT",
"header": [
],
"body": {
"mode": "raw",
"raw": "{\n \"name\": \"update-name\",\n \"description\": \"update-description\",\n \"private\": false\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "https://api.twitter.com/2/lists/:id",
"protocol": "https",
"host": [
"api",
"twitter",
"com"
],
"path": [
"2",
"lists",
":id"
],
"variable": [
{
"key": "id",
"value": null,
"description": "The ID of the List you wish to update the metadata of - the List must be owned by the authenticated user"
}
]
},
"description": "Allows the authenticated user to update a List they own.\n\nFor full details, see the [API reference](https://developer.twitter.com/en/docs/twitter-api/lists/manage-lists/api-reference/put-lists-id) for this endpoint.\n\n[Sign up](https://t.co/signup) for the Twitter API"
},
"response": [
]
}