← Back to team overview

dhis2-devs team mailing list archive

Re: Errors importing Events in 2.15 using the Web API (or maybe I am doing something wrong)

 

Thanks Morten,

This is the template I use

<?xml version="1.0"?>
<events>
<event program="FurLapSaYy4" orgUnit="TZPSI_P-1563" eventDate="2014-01-01"
status="COMPLETED" storedBy="jose">
<dataValues>
<dataValue dataElement="sQdFlFQptCX" value="34"/>
                 ................
</dataValues>
</event>
<event program="FurLapSaYy4" orgUnit="TZPSI_P-1563" eventDate="2014-01-01"
status="COMPLETED" storedBy="jose">
<dataValues>
<dataValue dataElement="sQdFlFQptCX" value="20"/>
                ................
</dataValues>
         </event>
</events>

Now I get the error: HTTP Status 500 - Can not deserialize instance of
java.lang.String out of START_OBJECT token


On Thu, Aug 14, 2014 at 10:38 AM, Morten Olav Hansen <mortenoh@xxxxxxxxx>
wrote:

> Sorry, the xml format has changed a bit.. you don't require a eventList
> anymore..
>
> You can just do:
> <events>
>   <event> ... </event>
>   <event> ... </event>
>   <event> ... </event>
> </events>
>
> --
> Morten
>
>
> On Thu, Aug 14, 2014 at 3:35 PM, Jose Garcia Muñoz <josemp10@xxxxxxxxx>
> wrote:
>
>>
>> Ups.... thanks Morten. Now it is working fine for one event. Thank you.
>>
>> what about sending multiple events? I am still getting " HTTP Status 500
>> - Unrecognized field "eventList" "
>>
>>
>> On Thu, Aug 14, 2014 at 7:10 AM, Morten Olav Hansen <mortenoh@xxxxxxxxx>
>> wrote:
>>
>>> Hi
>>>
>>> The id scheme must be added to the url, and not the actual payload..
>>>
>>> --
>>> Morten
>>>
>>>
>>> On Thu, Aug 14, 2014 at 4:58 AM, Jose Garcia Muñoz <josemp10@xxxxxxxxx>
>>> wrote:
>>>
>>>>
>>>> Dear Dev community
>>>>
>>>> I am trying to import several events to DHIS2 (2.15) using the Web API.
>>>> This is a template of the XML file (note I am using the org. unit code for
>>>> matching):
>>>>
>>>> <?xml version="1.0"?>
>>>> <event program="FurLapSaYy4" orgUnit="TZPSI_P-1563"
>>>> eventDate="2014-01-01" status="COMPLETED" storedBy="jose">
>>>>  <dataValues>
>>>> <dataValue dataElement="sQdFlFQptCX" value="34"/>
>>>> <dataValue dataElement="gVqInPr2eqC" value="30-34"/>
>>>>  <dataValue dataElement="hjy1KTANQbl" value="Unknown"/>
>>>> <dataValue dataElement="es3zQNdcN7d" value="4"/>
>>>>                </dataValues>
>>>> </event>
>>>>
>>>> When I call the API, I get the following error: "Event.orgUnit does not
>>>> point to a valid organisation unit". So, following the documentation I
>>>> added the attribute orgUnitIdScheme="code", something like the
>>>> following: <event program="FurLapSaYy4" orgUnit="TZPSI_P-1563"
>>>> eventDate="2014-01-01" status="COMPLETED" orgUnitIdScheme="code"
>>>> storedBy="jose"> However, in this case I am getting: "HTTP Status 500 -
>>>> Unrecognized field "orgUnitIdScheme".
>>>>
>>>> Also as I have to send multiple events, I am using the schema:
>>>>
>>>> <?xml version="1.0"?><events>
>>>> <eventList>
>>>>  <event program="FurLapSaYy4" orgUnit="TZPSI_P-1563"
>>>> eventDate="2014-01-01" status="COMPLETED" storedBy="jose">
>>>>  <dataValues>
>>>>                 ......
>>>>
>>>> but in this case the error I got is "HTTP Status 500 - Unrecognized
>>>> field "eventList"
>>>>
>>>> Am I missing something? I tried to use the Import/Export app as well,
>>>> but nothing was imported.
>>>>
>>>>
>>>> I am using the 2.15 with the build revision 15201
>>>>
>>>> Many thanks
>>>> Jose
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Mailing list: https://launchpad.net/~dhis2-devs
>>>> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
>>>> Unsubscribe : https://launchpad.net/~dhis2-devs
>>>> More help   : https://help.launchpad.net/ListHelp
>>>>
>>>>
>>>
>>
>

Follow ups

References