Server-to-server custom code

0 votes
Hello, 
 
I need to communicate with an external server log regarding payment. 
 
I think you'll create a custom code, please let us know the bapbeop. 
 
The sample code.
 

API Spec

URL : https://api.kakao.com/v1/token/check.json

method : GET

Parameter

access_token : 카카오 유저 액세스 토큰

user_id : 카카오 회원번호

client_id : 게임의 클라이언트 아이디

sdkver : 이용중인 카카오게임 SDK 버전

Response Code

SUCCESS : 0

UNAUTHORIZED : 401, 토큰이 유효하지 않음

UNREGISTERED_USER : -13, 가입하지 않은 유저

ERROR : -500, 파라미터가 없거나 형식이 올바르지 않은 경우

Java Sample Code


String urlParameters = "client_id=88073051597566064" +
        "&user_id=90360566856112065" +
        "&access_token=H6pLrC3VMMn1eS6rF-Y-Vt3tGjQ2mDTz0BnWMNfsUrvBXz8lrhluRXRiJiUoBduXJK0LBMp9Je997NpfxYkcIg" +
        "&sdkver=1.2.8";
String request = "https://api.kakao.com/v1/token/check.json?" + urlParameters;
URL url = new URL(request);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connection.setReadTimeout(15*1000);
connection.connect();

BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
StringBuilder stringBuilder = new StringBuilder();
String line;

while ((line = reader.readLine()) != null) {
    stringBuilder.append(line).append("\n");
}
System.out.print(stringBuilder);
reader.close();
connection.disconnect();
 
Sample code, please. 
Thank you.
 
 
asked Oct 5, 2014 in App42 Cloud API-BaaS by jeongdoojin8 (10 points)

1 Answer

0 votes
Yes, you are right. You have to use Custom Code and make a HTTP connection from third party web service using class HttpURLConnection in your custom code.

Your sample code looks fine. Let me know if you are facing any issue here.

Thanks

Ajay
answered Oct 6, 2014 by ajay123 (899 points)
It works well.
Thank you.
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...