Nurul Nabila Mahadi
Nurul Nabila Mahadi

Reputation: 43

Post method return 400 bad request in android

  save.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                AC_Daily_H spsTrans = new AC_Daily_H();
                Integer status = 0;
                spsTrans.AC_ID = getDate();
                spsTrans.SP_EMP_ID = spempid.getText().toString();
                spsTrans.Line = "1";
                spsTrans.Startdatetime = startdate;
                spsTrans.Endatetime = getCreateDate();



                    restService.getService().addACDailyH(spsTrans, new Callback<AC_Daily_H>() {
                        @Override
                        public void success(AC_Daily_H spsTrans1, Response response) {
                        }

                        @Override
                        public void failure(RetrofitError error) {
                            Toast.makeText(Attendance.this, error.getMessage().toString(), Toast.LENGTH_LONG).show();

                        }
                    });

when I add ACDailyLine turn to 4oo bad request for both post method


                AC_Daily_Line ac_daily_line = new AC_Daily_Line();
                ac_daily_line.AC_ID = getDate();
                ac_daily_line.Emp_ID = "0";
                restService.getService().addACDailyLine(ac_daily_line, new Callback<AC_Daily_Line>() {
                    @Override
                    public void success(AC_Daily_Line ac_daily_line1, Response response) {
                    }

                    @Override
                    public void failure(RetrofitError error) {
                        Toast.makeText(Attendance.this, error.getMessage().toString(), Toast.LENGTH_LONG).show();

                    }
                });
                    Toast.makeText(Attendance.this, "Data Inserted Successfully!", Toast.LENGTH_SHORT).show();
                    finish();
            }
        });

why when I put only ACDailyH post method, everything is okay, return 201 REQUEST. when I add for AcDailyLine both return 400 bad requests. please help, thank you in advance:)

enter image description here

enter image description here here when I test each of post method in fiddler

enter image description here

here when I debug the line

Upvotes: 0

Views: 524

Answers (1)

siwarak
siwarak

Reputation: 197

Bad request return from your api, It will be easier if you find what wrong about your parameter in api side.

For workaround on mobile side here

Upvotes: 2

Related Questions