Pinterest PDK createPin (...) release

When creating a new pin using PDK createPin () method for Android app

public void createPin (String note, String boardId, String imageUrl, String link, PDKCallback callback)

it gives an error response with error code 400, without a proper error message. Below is the code I used.

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();
                        }
                    });

      

There is nothing related to boardID as other apis with the same boardID are working fine. Simply creating a new pin does not work. I couldn't find a solution for this.

Here is the 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)

      

+3


source to share


1 answer


Change the line

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

from



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

Later when you submit the URL for the image, make sure the URL has an extension like " http://goldwallpapers.com/uploads/posts/blue-tiger-wallpaper/blue_tiger_wallpaper_001.jpg ." A URL like https://www.instagram.com/p/BUAs-jVF9Fx/?taken-by=chelseasmakeup "doesn't work.

+1


source







All Articles