Java Developers’ Reference

Thriftly Metadata Encyclopedia

This section provides additional details on the Thriftly-specific metadata you’ll add to your application as you create APIs and implement various Beyond the Basics features:

  • @AuthAttribute: Used to specify the function that protects your service’s other functions, if you have chosen to implement JWT-based authorization (as described in the Securing Your API with JSON Web Tokens (JWTs) topic). You should never publish the function that uses this attribute, and largely, you should write the function that uses this attribute exactly as that function is written in our documentation. For example, your Auth function must include all three of and only the int imethodID, String sMethodName, and Token toke parameters. Your place this attribute above your Auth function.

  • @DocumentationAttribute: Used to provide documentation for your API (as described in the Adding and Accessing API Documentation section). Using iterations of this attribute, you can provide other developers with a description of what a particular function within your API does, what parameters that function includes, and what values that function returns. This documentation then appears at your service’s service URL when you publish your API on the Thriftly Server. You place this attribute above your function.

  • @ParametersName: Used to pass the name of your function’s parameters to the Thriftly Server, using the (Names = { “”, “” , “etc.” }) specification. If you do not include this attribute and a list of parameter names above your function, the Thriftly Server will assign default names to your function’s parameters. We highly recommend using this attribute to provide custom parameter names (as we do in our Java examples), to make it easier to work with the Thriftly API version of your function.

  • @PublishedAttribute: Used to make a function accessible as part of your Thriftly API. When you publish an application service as an API, Thriftly makes any functions marked with @PublishedAttribute available over the Thriftly Server, allowing developers to integrate that function into new applications. Note that if a service contains multiple functions, some of which do not include @PublishedAttribute, only functions that include @PublishedAttribute are published as part of your API. In this way, you can publish some functions within a service while keeping others private. You place this attribute above the function you want to make available as part of your API.

  • @UnsecuredAttribute: Used to specify functions that should not be secured, if you have chosen to implement JWT-based authorization (as described in the Securing Your API with JSON Web Tokens (JWTs) topic). Primarily, this attribute is used to specify which function within your service should be recognized as a login function, using the (Login = true) specification. Typically, if you implement JWT-based authorization, users will have to perform a valid call to your login function to receive a JWT and use the other functions included within your service. However, you can also add the @UnsecuredAttribute to other functions within your service, if you do not want to require users to retrieve and provide a valid JWT before using those functions. You place this attribute between the @PublishedAttribute and your function.

Thriftly-Supported Data Types

This section lists the subset of Java data types that Thriftly supports. Thriftly supports only a subset of data types. For example, Thriftly does not support pointer types or variant type parameters, because Thriftly itself is strongly typed. Our list of supported data types includes:

  • Arrays of supported types

  • BigInt

  • Boolean

  • Date

  • Datetime

  • Float/Real

  • Integer

  • Number/Decimal

  • Short

  • String

  • Struct

  • UChar (Note: Thriftly treats UChar functions as binary functions. You can use UChar functions to pass or return binary data from your APIs.)