clientapi java,Client Libraries

Podio Java Client

The Java client provides coverage of a large part of the API.

Getting the client

The client is built using Maven and is available in the official Maven repository. To use the client in a Maven project simply add a dependency on com.podio.api. If you use Eclipse, you can follow these steps:

Create a new Maven project (make sure you have Maven integration installed)

Double-click pom.xml and go to the Dependencies tab

Click the Add button in the Dependencies list to the left

Enter "podio" in the search field and select the newest version of com.podio.api

Click OK and rebuild the project

The client can also be used by cloning the GitHub repository at https://github.com/podio/podio-java using the command git clone git@github.com:podio/podio-java.git.

Constructing API client instance and authentication

The main entry point for the API client is the com.podio.APIFactory class. This class supplies methods for getting API interfaces for each of the API areas. To construct a new API factory a com.podio.ResourceFactory instance must be supplied. The resource factory takes two parameters for construction, the client credentials and the authentication credentials. The client credentials are the key and secret from the API client registration. The authentication credentials can be any of the different authentication methods described in the authentication article.

java

ResourceFactory resourceFactory = new ResourceFactory(

new OAuthClientCredentials(clientId, clientSecret),

new OAuthUsernameCredentials(username, password));

APIFactory apiFactory = new APIFactory(resourceFactory);

The API factory can then be used to get an interface for each of the areas of the API. The following will get the user area and then use the area to get the profile for the authenticated user and print out the name.

java

UserAPI userAPI = apiFactory.getAPI(UserAPI.class);

Profile profile = userAPI.getProfile();

System.out.println(profile.getName());

Samples

There are many samples available on how the Java client can be used. They are all available on GitHub:

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值