コード例 #1
0
  /**
   * Retrieve the details about a product which exists on the Wish platform. You must have the
   * unique product Id that was returned upon product creation.
   *
   * @param productId id
   * @param apiKey apiKey
   * @return Boolean
   */
  public Boolean retrieveProductVariationBoolean(String productId, String apiKey) {
    String url =
        PropertiesUtil.getRetrieveProductVariation()
            .replace("product_id", productId)
            .replace("an_example_api_key", apiKey);
    // 发起POST请求
    JSONObject jsonObject = CommonUtil.httpsRequest(url, "GET", null);

    if (null != jsonObject) {
      int code = jsonObject.getInt("code");
      if (0 == code) {
        return true;
      } else {
        return false;
      }
    } else {
      return false;
    }
  }
コード例 #2
0
  /**
   * Retrieve the details about a product which exists on the Wish platform. You must have the
   * unique product Id that was returned upon product creation.
   *
   * @param productId id
   * @param apiKey apiKey
   * @return JSONObject
   */
  public JSONObject retrieveProductVariationJSONObject(String productId, String apiKey) {
    String url =
        PropertiesUtil.getRetrieveProductVariation()
            .replace("product_id", productId)
            .replace("an_example_api_key", apiKey);
    // 发起POST请求
    JSONObject jsonObject = CommonUtil.httpsRequest(url, "GET", null);

    if (null != jsonObject) {
      int code = jsonObject.getInt("code");
      if (0 == code) {
        return jsonObject;
      } else {
        JSONObject errorJsonObject = new JSONObject();
        return errorJsonObject.element("message", jsonObject.getString("message"));
      }
    } else {
      return null;
    }
  }