# Garoon APIで設備の予定を取得したい

**URL:** <https://community.cybozu.dev/t/topic/2794>\
**Category:** kintone 開発相談\
**Created:** [2016 年 12 月 13 日午前 8:49 UTC](https://community.cybozu.dev/t/topic/2794 "2016-12-13T08:49:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Legacy\_Account155](https://avatars.discourse-cdn.com/v4/letter/l/9de0a6/32.png) [@Legacy\_Account155](https://community.cybozu.dev/u/Legacy_Account155)\
**Post date:** [2016 年 12 月 13 日午前 8:49 UTC](https://community.cybozu.dev/t/topic/2794/1 "2016-12-13T08:49:40Z")

</div>

今日はGaroon API「ScheduleGetEventsByTarget」を使って、Bad responseのエラーメッセージを出てきた。

严重: SAAJ0008: 响应错误; Garoon Error  
Exception in thread “main” cn.net.cybozu.webservice.garoon3.Garoon3WebServiceException: com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Bad response: (520Garoon Error  
&nbsp;at cn.net.cybozu.webservice.garoon3.Garoon3WebService.execute(Garoon3WebService.java:213)  
&nbsp;at sample.ScheduleGet.main(ScheduleGet.java:53)  
Caused by: com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Bad response: (520Garoon Error  
&nbsp;at com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection.call(Unknown Source)  
&nbsp;at cn.net.cybozu.webservice.garoon3.Garoon3WebService.execute(Garoon3WebService.java:135)  
&nbsp;… 1 more  
Caused by: com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Bad response: (520Garoon Error  
&nbsp;at com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection.post(Unknown Source)  
&nbsp;… 3 more

&nbsp;

パラメータは開始と終了の日付、ObjectTypeは設備FACILITYを設定しました、設備のidも設定しました。

SimpleDateFormat formatter = new SimpleDateFormat(“yyyyMMdd’ 'HHmmss”);  
&nbsp;&nbsp;formatter.setTimeZone(timezone);  
&nbsp;&nbsp;Date startDate = formatter.parse(“20161212 000000”);

&nbsp;

&nbsp;&nbsp;// end date  
&nbsp;&nbsp;formatter = new SimpleDateFormat(“yyyyMMdd’ 'HHmmss”);  
&nbsp;&nbsp;formatter.setTimeZone(timezone);  
&nbsp;&nbsp;Date endDate = formatter.parse(“20161215 235959”);

&nbsp;

&nbsp;&nbsp;action.setStartDate(startDate);  
&nbsp;&nbsp;action.setEndDate(endDate);&nbsp;&nbsp;  
&nbsp;&nbsp;action.setObjectType(ObjectType.FACILITY);  
&nbsp;&nbsp;action.setId(“5”);

&nbsp;

パラメータは何か間違ったですか？

解決方法をご存知の方がいらっしゃいましたら、ご教授頂けますと幸いです。

---

<div class="post-metadata">

**Author:** ![Legacy\_Account155](https://avatars.discourse-cdn.com/v4/letter/l/9de0a6/32.png) [@Legacy\_Account155](https://community.cybozu.dev/u/Legacy_Account155)\
**Post date:** [2016 年 12 月 13 日午前 9:13 UTC](https://community.cybozu.dev/t/topic/2794/2 "2016-12-13T09:13:46Z")

</div>

自分で解決した。

//下記のソースは変更すれば、OKになった

//変更前&nbsp;&nbsp;

action.setStartDate(startDate);  
action.setEndDate(endDate);&nbsp;

//変更後

action.setStartDateTime(startDate);  
action.setEndDateTime(endDate);&nbsp;&nbsp;

&nbsp;
