Pinterest PDK createPin(...)问题

时间:2017-07-29 07:07:52

标签: android pinterest pdk

使用PDK的Android应用的createPin()方法创建新引脚时,

  

public void createPin(String note,String boardId,String imageUrl,   字符串链接,PDKCallback回调)

它会抛出错误响应,错误代码为400,没有正确的错误消息。 下面是我一直在使用的代码。

String note = "Hello World!";
String boardID = "130323051656269527";
String imgURL = "https://www.instagram.com/p/BXB_J-mld0Z/?taken-by=chelseasmakeup";
PDKClient.getInstance().createPin(note, boardID, imgURL,null,
                    new PDKCallback() {
                        @Override
                        public void onSuccess(PDKResponse response) {
                            Log.e("TAG", "response: " + response.toString());
                        }

                        @Override
                        public void onFailure(PDKException exception) {
                            exception.printStackTrace();
                        }
                    });

boardID没有任何问题,因为具有相同boardID的其他api工作正常。只是创建新的引脚失败。我无法找到解决方案。

这是Log

PDK POST: https://api.pinterest.com/v1/pins/ 
BasicNetwork.performRequest: Unexpected response code 400 for https://api.pinterest.com/v1/pins/?access_token=AX4CNtTbNh5ftBz7W1gIcr8gpNFQFNW6RGIDvLtEMpH7NmBEFgAAAAA

com.pinterest.android.pdk.PDKException
07-29 12:19:35.320 2316-2316/com.simplify360.suit.testapp W/System.err:     at com.pinterest.android.pdk.PDKCallback.onErrorResponse(PDKCallback.java:28)
07-29 12:19:35.320 2316-2316/com.simplify360.suit.testapp W/System.err:     at com.android.volley.Request.deliverError(Request.java:598)
07-29 12:19:35.320 2316-2316/com.simplify360.suit.testapp W/System.err:     at com.android.volley.ExecutorDelivery$ResponseDeliveryRunnable.run(ExecutorDelivery.java:101)
07-29 12:19:35.320 2316-2316/com.simplify360.suit.testapp W/System.err:     at android.os.Handler.handleCallback(Handler.java:751)
07-29 12:19:35.320 2316-2316/com.simplify360.suit.testapp W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:95)
07-29 12:19:35.320 2316-2316/com.simplify360.suit.testapp W/System.err:     at android.os.Looper.loop(Looper.java:154)
07-29 12:19:35.320 2316-2316/com.simplify360.suit.testapp W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:6077)
07-29 12:19:35.320 2316-2316/com.simplify360.suit.testapp W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
07-29 12:19:35.321 2316-2316/com.simplify360.suit.testapp W/System.err:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
07-29 12:19:35.321 2316-2316/com.simplify360.suit.testapp W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)

1 个答案:

答案 0 :(得分:1)

更改行

  

if(!Utils.isEmpty(link))params.put(" image_url",imageUrl);

  

if(!Utils.isEmpty(imageUrl);))params.put(" image_url",imageUrl);

稍后当您传递图片网址时,请确保该网址的扩展名类似于" http://goldwallpapers.com/uploads/posts/blue-tiger-wallpaper/blue_tiger_wallpaper_001.jpg。"类似" https://www.instagram.com/p/BUAs-jVF9Fx/?taken-by=chelseasmakeup"的网址没有工作。