增強版實名認證介面-Java身份證實名認證介面程式碼-身份認證

翔云api發表於2024-03-13

數字化時代,資訊保安如同金盾,而身份驗證則是這面盾牌的核心環節。每一次登入的背後,都是您對隱私保護的渴望;每一次交易的信任,都源於對身份真實性的確認。現如今,隨著網路平臺的不斷增多,實名認證介面的需求也在不斷提升。
以下是Java語言呼叫翔雲身份實名認證API的程式碼:

package com.test;

import okhttp3.;
import org.json.JSONObject;
import java.io.
;
/**

  • 需要新增依賴
  • com.squareup.okhttp3
    
  • okhttp
    
  • 4.12.0
    

*/
class Sample {

static final OkHttpClient HTTP_CLIENT = new OkHttpClient().newBuilder().build();

public static void main(String []args) throws IOException{
	MediaType mediaType = MediaType.parse("text/plain");
	RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM)
	  .addFormDataPart("img","/9j")
	  .addFormDataPart("key","M***********g")
	  .addFormDataPart("secret","3***********6")
	  .addFormDataPart("trueName","陳**")
	  .addFormDataPart("idenNo","13***************3")
	  .addFormDataPart("typeId","3003")
	  .addFormDataPart("format","json")
	  .build();
	Request request = new Request.Builder()
	  .url("https://netocr.com/verapi/veriden.do")
	  .method("POST", body)
	  .build();
	Response response = HTTP_CLIENT.newCall(request).execute();
	System.out.println(response.body().string());
}

}

相關文章