Skip to content

Latest commit

 

History

History
81 lines (61 loc) · 2.34 KB

GeneralApi.md

File metadata and controls

81 lines (61 loc) · 2.34 KB

GeneralApi

All URIs are relative to https://api.twitter.com

Method HTTP request Description
getOpenApiSpec GET /2/openapi.json Returns the OpenAPI Specification document.

getOpenApiSpec

Object getOpenApiSpec().execute();

Returns the OpenAPI Specification document.

Full OpenAPI Specification in JSON format. (See https://github.com/OAI/OpenAPI-Specification/blob/master/README.md)

Example

// Import classes:
import com.twitter.clientlib.ApiClient;
import com.twitter.clientlib.ApiException;
import com.twitter.clientlib.Configuration;
import com.twitter.clientlib.model.*;
import com.twitter.clientlib.TwitterCredentialsOAuth2;
import com.twitter.clientlib.TwitterCredentialsBearer;
import com.twitter.clientlib.api.TwitterApi;

import com.twitter.clientlib.api.GeneralApi;
import java.util.List;
import java.util.Set;
import java.util.Arrays;
import java.util.HashSet;
import java.time.OffsetDateTime;

public class Example {
  public static void main(String[] args) {
    // Set the credentials based on the API's "security" tag values.
    // Check the API definition in https://api.twitter.com/2/openapi.json
    // When multiple options exist, the SDK supports only "OAuth2UserToken" or "BearerToken"

    // Uncomment and set the credentials configuration
    TwitterApi apiInstance = new TwitterApi(credentials);

    // Set the params values
    try {
           Object result = apiInstance.general().getOpenApiSpec()
            .execute();
            System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling GeneralApi#getOpenApiSpec");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Parameters

This endpoint does not need any parameter.

Return type

Object

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 The request was successful -