Chilkat Online Tools

lianja / Twitter API v2 / Unhide a reply

Back to Collection Items

// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

loHttp = createobject("CkHttp")

// Use this online tool to generate code from sample JSON: Generate Code to Create JSON

// The following JSON is sent in the request body.

// {
//   "hidden": false
// }

loJson = createobject("CkJsonObject")
loJson.UpdateBool("hidden",.F.)

// Adds the "Authorization: Bearer <access_token>" header.
loHttp.AuthToken = "<access_token>"
loHttp.SetRequestHeader("Content-Type","application/json")

loSbRequestBody = createobject("CkStringBuilder")
loJson.EmitSb(loSbRequestBody)

loResp = loHttp.PTextSb("PUT","https://api.twitter.com/2/tweets/:id/hidden",loSbRequestBody,"utf-8","application/json",.F.,.F.)
if (loHttp.LastMethodSuccess = .F.) then
    ? loHttp.LastErrorText
    release loHttp
    release loJson
    release loSbRequestBody
    return
endif

? str(loResp.StatusCode)
? loResp.BodyStr
release loResp


release loHttp
release loJson
release loSbRequestBody

Curl Command

curl -X PUT
	-H "Authorization: Bearer <access_token>"
	-H "Content-Type: application/json"
	-d '{
    "hidden": false
}'
https://api.twitter.com/2/tweets/:id/hidden

Postman Collection Item JSON

{
  "name": "Unhide a reply",
  "request": {
    "method": "PUT",
    "header": [
      {
        "key": "Content-Type",
        "type": "text",
        "value": "application/json"
      }
    ],
    "body": {
      "mode": "raw",
      "raw": "{\n    \"hidden\": false\n}"
    },
    "url": {
      "raw": "https://api.twitter.com/2/tweets/:id/hidden",
      "protocol": "https",
      "host": [
        "api",
        "twitter",
        "com"
      ],
      "path": [
        "2",
        "tweets",
        ":id",
        "hidden"
      ],
      "variable": [
        {
          "key": "id",
          "value": "",
          "type": "string",
          "description": "Required. Enter a single Tweet ID."
        }
      ]
    },
    "description": "Provides the ability to unhide a reply to a Tweet.\n\nFor full details, see the [API reference](https://developer.twitter.com/en/docs/twitter-api/tweets/hide-replies/api-reference/put-tweets-id-hidden) for this endpoint.\n\n[Sign up](https://t.co/signup) for the Twitter API"
  },
  "response": [
  ]
}