2013-05-31 2 views
1

PicasaPhotoAlbum에 액세스하기 위해 WebService를 구현하고 싶습니다. 그러나 나는 다음과 같은 문제가있다 :
것은 내가 URL 다음 한 :이 작동하지 않습니다Picasa API - URL이 태그와 함께 작동하지 않습니다.

URL feedUrl = new URL("https://picasaweb.google.com/data/feed/api/user/466601293793610730264/album/Testalbum?tag=Test"); 

. 그러나 "? tag = Test"를 삭제하면 URL은 다음과 같이 보입니다.

URL feedUrl = new URL("https://picasaweb.google.com/data/feed/api/use/466601293793610730264/album/Testalbum"); 

코드가 완벽하게 작동합니다. 것은, 나는 단지 특별한 꼬리표를 가진 그림이 있고 싶다이다. 왜 누군가가 "? tag = Test"와 함께 작동하지 않는지 설명 할 수 있습니까?

public class RaceDriverImport implements IRaceDriverService { 
PicasawebService myService = new PicasawebService("TestIt"); 

public RaceDriverImport() throws AuthenticationException { 
    myService.setUserCredentials("[email protected]", "99thisisabadpw77"); 
} 

@Override 
public List<RaceDriver> getRaceDrivers() throws IOException, ServiceException { 
URL feedUrl = new URL("https://picasaweb.google.com/data/feed/api/user/466601293793610730264/album/Testalbum?tag=Test"); 

    AlbumFeed feed = myService.getFeed(feedUrl, AlbumFeed.class); 

    for (PhotoEntry photo : feed.getPhotoEntries()) { 
     System.out.println(photo.getTitle().getPlainText()); 
    } 
    List<RaceDriver> drivers = null; 
    return drivers; 
} 
+0

오류가 무엇입니까? HTTP 오류 코드가 무엇인지, 관련 메시지는 무엇입니까? – fge

+0

URL 끝에 태그를 사용하면 오류가 발생합니다. 사진이 없습니다. 나는 또한 내 브라우저에서 그것을 시도하고 거기에 작동합니다. –

+0

매개 변수를 추가 할 때 우리의 앨범 피드는 null입니다. –

답변

1

당신은 당신이 사용하고있는 버전이 말을하지 않습니다,하지만 버전 2.0 당신은이 방법을 수행합니다 :

URL feedUrl = new URL("https://picasaweb.google.com/data/feed/api/user/466601293793610730264/album/Testalbum"); 

Query myQuery = new Query(feedUrl); 
myQuery.setStringCustomParameter("kind", "photo"); 
myQuery.setStringCustomParameter("tag", "test"); 

내 전체 코드는 (나는 피카사 API 버전 2.0을 사용)입니다

참조 : https://developers.google.com/picasa-web/docs/2.0/developers_guide_java#SearchByTags

+0

예, 2.0 버전을 사용합니다. –

+0

안녕하세요, 저는 같은 프로젝트에서 Michael Langhamer와 함께 일하고 있습니다. 답해 주셔서 감사합니다. 그러나 문제를 해결하지 못했습니다. 매개 변수를 추가 할 때 우리의 AlbumFeed는 여전히 코드에서 null이됩니다. 브라우저에서 URL을 액세스하면 작동합니다. 요청을 한 후에 태그로 인해 사진을 필터링 할 수 있습니까? 매개 변수없이 요청이 잘 작동하기 때문에. –

+0

당신은 AlbumFeed feed = myService.query (myQuery, AlbumFeed.class)를하고 있습니까? (myService.getFeed (feedUrl, AlbumFeed.class)를 사용하지 않음) –

관련 문제