AnsweredAssumed Answered

akamai open api ccu purge is failing

Question asked by Praveen Polishetty on Aug 17, 2015
Latest reply on Aug 18, 2015 by Laurence Leccia

Hi everyone,

 

 

 

code:

String json = getPurgeJson("{\"objects\":[\"456\"],\"action\":\"remove\",\"type\":\"cpcode\",\"domain\":\"staging\"}");

        JsonHttpContent content = new JsonHttpContent(new JacksonFactory(),

                json);

HttpRequest request = requestFactory

                .buildPostRequest(new GenericUrl(uri),content);

 

 

 

private static String getPurgeJson(String fileUri) {

    StringBuffer jsonBuff = new StringBuffer();

    jsonBuff.append("{\"objects\":[");

    jsonBuff.append("\"");

    jsonBuff.append(fileUri);

    jsonBuff.append("\"");

    jsonBuff.append("]}");

    return jsonBuff.toString();

  }



Error:

Exception in thread "main" com.google.api.client.http.HttpResponseException: 400 Bad Request

{"supportId": "17PY1439843078513299-1233388", "title": "invalid json object", "httpStatus": 400, "detail": "The request was not a valid json object", "describedBy": "https://api.ccu.akamai.com/ccu/v2/errors/invalid-json-object"}

    at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:1054)

 

 

I have also tried  converting the pojo object to JSON using "gson.toJson(akamaiPurgeRequest)" and no luck.

 

 

Any help?

Outcomes