Skip to Main Content

400 BadRequest on REST API for Cloud Content and Experience

3480066Jun 5 2017 — edited Apr 8 2019


I'm trying to access my content/document cloud with REST API for Android Platform,

My request call to get folder information and all working fine ,
Now that I'm trying to upload a file as per details mentioned here

I ended up with 400 Bad Request , I don't know what I'm missing or not doing.

Can any one help me out.

Following are the frameworks & tools used,

Android SDK & Android Studio
Retrofit 2

Following are the gradle/library version

compile 'com.squareup.retrofit2:retrofit:2.3.0'
compile 'com.squareup.retrofit2:converter-gson:2.3.0'
compile 'com.squareup.okhttp3:logging-interceptor:3.4.1'
compile 'com.squareup.okhttp3:okhttp:3.4.1'

Java/Android Http Request with Retrofit 2

File f = new File(filepath);

                    RequestBody fbody = RequestBody.create(MediaType.parse("text/plain"), f );

                    JSONObject obj = new JSONObject();

                    try {


                    } catch (JSONException e) {



                    RequestBody inputParams = RequestBody.create(MediaType.parse("text/plain"), obj.toString() );

                    Call<FolderItem> call = service.uploadFile(getString(R.string.authorization) ,


                            inputParams ,

                            MultipartBody.Part.createFormData( "primaryFile", filename, fbody)


                    Response<FolderItem> result = call.execute();

                    res = result.body();

REST API ( Retrofit 2 ) Response

--> POST http/1.1

D/OkHttp: Content-Type: multipart/form-data

D/OkHttp: Content-Length: 12845

D/OkHttp: Authorization: Basic cmFtYW51amEuaEBjYXJpdG9yc29sdXRpb25zLmNvbTpTb2x1dGlvbnMxMiM=

D/OkHttp: --7a1df051-4bf6-4118-80b4-6ea1aaaa9857

D/OkHttp: Content-Disposition: form-data; name="jsonInputParameters"

D/OkHttp: Content-Transfer-Encoding: binary

D/OkHttp: Content-Type: text/plain; charset=utf-8

D/OkHttp: Content-Length: 19

D/OkHttp: {"parentID":"self"}

D/OkHttp: --7a1df051-4bf6-4118-80b4-6ea1aaaa9857

D/OkHttp: Content-Disposition: form-data; name="primaryFile"; filename="0707160007_1.jpeg"

D/OkHttp: Content-Type: text/plain

D/OkHttp: Content-Length: 12409


D/OkHttp: --7a1df051-4bf6-4118-80b4-6ea1aaaa9857--

D/OkHttp: --> END POST (12845-byte body)

D/OkHttp: <-- 400 Bad Request (3841ms)

D/OkHttp: Date: Mon, 05 Jun 2017 05:06:02 GMT

D/OkHttp: Server: Oracle-Application-Server-11g

D/OkHttp: Cache-Control: no-store

D/OkHttp: Pragma: no-cache

D/OkHttp: Expires: 0

D/OkHttp: X-ORACLE-DMS-ECID: 005KIxpdAsl6qIFpR0k3yd0001Gn0003i8

D/OkHttp: Set-Cookie: JSESSIONID=7RN2pUjpCNwQX9OowLA8uWqKD64VewIR194Y6NEzpxh9oBFEbE_O!1991547872!1880700994; path=/; HttpOnly

D/OkHttp: X-Content-Type-Options: nosniff

D/OkHttp: Connection: close

D/OkHttp: Content-Type: application/json; charset=utf-8

D/OkHttp: Content-Language: en

D/OkHttp: {

D/OkHttp: "errorCode": "-97",

D/OkHttp: "errorKey": "!csUnableToCheckIn,(null)!csServiceParametersMissing,CHECKIN_UNIVERSAL",

D/OkHttp: "errorMessage": "Content item '(null)' was not successfully checked in. One or more service parameters for service CHECKIN_UNIVERSAL are missing.",

D/OkHttp: "title": "Content item '(null)' was not successfully checked in. One or more service parameters for service CHECKIN_UNIVERSAL are missing.",

D/OkHttp: "type": ""

D/OkHttp: }

D/OkHttp: <-- END HTTP (465-byte body)

Oracle Documentation example format for API request

An example of an alternative request body follows.

Content-Disposition: form-data; name="jsonInputParameters" 
{ "parentID":"FB4CD874EF94CD2CC1B60B72T0000000000100000001" }
Content-Disposition: form-data; name="primaryFile"; filename="example.txt"
Content-Type: text/plain 
<File Content>
Post Details
Added on Jun 5 2017