2013-12-19 5 views
1

미러 API을 사용하는 타임 라인 항목이 있습니다. 이제 타임 라인의 콘텐츠를 번들에서 변경하려고합니다. 그러나 아래의 오류가타임 라인 항목 업데이트 오류

An error occurred from update timeline : com.google.api.client.googleapis.json.GoogleJsonResponseException: 404 Not Found 
{ 
    "code" : 404, 
    "errors" : [ { 
    "domain" : "global", 
    "message" : "Not Found", 
    "reason" : "notFound" 
    } ], 
    "message" : "Not Found" 
} 

발생 및 업데이트 방법은 내가 타임 라인 항목을 검색하려고

public static TimelineItem updateTimelineItem(Credential credential, 
     String itemId, String newText) { 
    try { 
     Mirror.Timeline timeline = getMirror(credential).timeline(); 
     TimelineItem timelineItem = timeline.get(itemId).execute(); 

     timelineItem.setText(newText); 

     return timeline.update(itemId, timelineItem).execute(); 
    } catch (IOException e) { 
     System.err.println("\nAn error occurred from update timeline : " + e); 
     return null; 
    } 
} 

먼저 아래처럼 뭔가 내가 실행 쓸 때, 다음 오류가

Mirror.Timeline timeline = getMirror(credential).timeline(); 
TimelineItem timelineItem = timeline.get(itemId).execute(); 
을 발생했습니다

어떻게 해결할 수 있습니까?

답변

0

게시 한 예외가 완전히 명확하지는 않지만 itemId가 유효하지 않은 것으로 보입니다. 이 itemId를 어떻게 얻었습니까? 문제의 원인이되는 타임 라인 .get 또는 타임 라인 업데이트인지 여부를 확인할 수 있습니까?

+0

타임 라인 항목 번들을 만들 때 수동으로 타임 라인 ID를 설정했습니다. 그런 다음 update 메소드를 사용하여 텍스트를 변경하십시오. 그래서 타임 라인 아이템 ID를 알고 있습니다. –

+2

타임 라인 항목 ID는 새 카드를 삽입 할 때 항상 자동으로 생성되며 번들 ID와 다릅니다. 실제 아이템 ID를 얻으려면 삽입 요청의 응답을 읽거나 timeline.list를 사용하여 아이템 ID가있는 카드를 다시 찾아야합니다. – Scarygami

+0

ID를 확인합니다. 괜찮습니다. 실행하려고하면 오류가 발생합니다. timeline.get (itemId) .execute() –