{“error”:{“message”:“(#100) Missing message or attachment”,“type”:“OAuthException”,“code”:100}} Code Answer

Hello Developer, Hope you guys are doing great. Today at Tutorial Guruji Official website, we are sharing the answer of {“error”:{“message”:“(#100) Missing message or attachment”,“type”:“OAuthException”,“code”:100}} without wasting too much if your time.

The question is published on by Tutorial Guruji team.

This is my code

    private void postToWall(String msg) {
    Bundle parameters = new Bundle();

    JSONObject attachment = new JSONObject();

    String myjosn="{"name":"LangGuage","href":"http://www.hunkatech.com","caption":" ","description":""+messageToPost+"","media":[{"type":"image","src":"http://hwsdemos.com/LangGuage/medal_1.png","href":"http://www.hunkatech.com"}],"properties":{"Powered by:":{"text":"Hunka Technology Pvt. Ltd.","href":"http://www.hunkatech.com"}}}";  

            try {



        parameters.putString(Facebook.TOKEN, facebook.getAccessToken());

            parameters.putString("attachment",myjosn.toString());


        String response = facebook.request("me/feed", parameters, "POST");

        System.out.println("----responce" + response);

        if (response.contains("Duplicate status message")) {
            progressHandler.sendEmptyMessage(1);
            resp = 1;

        } else if (response == null || response.equals("")
                || response.equals("false") || response.contains("error")) {
            Log.d("error", "error response");
        } else {
            progressHandler.sendEmptyMessage(0);
            resp = 0;

        }

    } catch (Exception e) {
        Log.e(TAG, "Posting fail");

        e.printStackTrace();

    }

}

I want to post message with image on Facebook wall.my json is correct i have checked it on json formatter editor.I got following exception.need suggestion how to solve it.

UPDATE: My message and images posted with the help of below code:

parameters.putString("link", "http://www.hunkatech.com");
parameters.putString("picture", "http://hwsdemos.com/LangGuage/medal_1.png");
parameters.putString("name", "LangGuage");// name of link
parameters.putString("captions", "hello");
parameters.putString("message", "This is my message!!");

But I want to have image left to the text but above code gives result as Imgae below message. UPDATE: I am unable to post anything form json.can anyone please solve this problem I want to send attachment which bind image and massege with json.

Answer

Here how I done it.

private void publishFeedDialog() {
        System.out.println("Working");
        Bundle postParams = new Bundle();
        postParams.putString("name", "I am an Engineer");
        postParams.putString("caption",
                "Working very heard to make things work.");
        postParams
                .putString("description",
                        "This project is killing me, Still I am trying, and finally I got success.");
        postParams.putString("link", "http://www.kodebusters.com");
        postParams
                .putString(
                        "picture",
                        "http://cdn1.iconfinder.com/data/icons/iconslandsport/PNG/128x128/Soccer_Ball.png");

        new MYasync(postParams).execute();

    }

Run your network calls on AsyncTask or it may through exception

 class MYasync extends AsyncTask<Void, Void, Void> {

            Bundle params;
            private String res;

            public MYasync(Bundle params) {
                super();
                this.params = params;
            }

            @Override
            protected void onPostExecute(Void result) {
                System.out.println(res);
                super.onPostExecute(result);
            }

            @Override
            protected Void doInBackground(Void... pp) {
                try {
                    res = facebook.request("me/feed", params, "POST");

                } catch (FileNotFoundException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                } catch (MalformedURLException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
                return null;
            }

        }
We are here to answer your question about {“error”:{“message”:“(#100) Missing message or attachment”,“type”:“OAuthException”,“code”:100}} - If you find the proper solution, please don't forgot to share this with your team members.

Related Posts

Tutorial Guruji