cancel
Showing results for 
Search instead for 
Did you mean: 

getItemData integration api: unable to read data for custom item

saurav_das
Advisor
Advisor
0 Kudos

Hello,

I am trying to retrieve the data of an custom item via the getItemData api but i am gett the error message

"Not implemented for this item type"

I checked the api documentation, the list of supported item types include custom methods.

Is there any thing that i need to maintain for the custom method so that i can read the data stored by it using the getItemData api.

or is it simply not possible to read custom item data.

Thanks for the help,

Regards,

Saurav

Accepted Solutions (1)

Accepted Solutions (1)

RuedigerMueller
Advisor
Advisor
0 Kudos

Hi Saurav,

I am not sure if I understand the problem. Do you create the custom item via API or via the UI?

Try creating you custom item via the UI and save the data. Does this work? In that case the API should also return the stored data. This of course only works when you save your content on StreamWork and are not using calls to external systems.

Regards,

Rüdiger

saurav_das
Advisor
Advisor
0 Kudos

Hi Ruediger,

Thanks for the reply.

To test the getItemData API i have implemented the hello world custom method example (java script).

I created an item using the UI and edidted the content.

when i try to read the saved data using the api i am getting the message

encountered an error: 
Server returned HTTP response code: 400 for URL: <a href="https://streamwork.com/v1/items/5EXAbr-TgVCJV1qgL8-g1W/item_data" TARGET="test_blank">https://streamwork.com/v1/items/5EXAbr-TgVCJV1qgL8-g1W/item_data</a>?
<?xml version="1.0" encoding="UTF-8"?>
<error>
  <http_status>400 Bad Request</http_status>
  <message>Not implemented for this item type.</message>
</error>

When i try to read the data of a text item using the same API I am getting the correct response

<text_item>
   <text_content><p>Hello testing</p></text_content>
</text_item>

So i was wondering how i can implement the getItemData for my custom method.

Thanks and regards,

Saurav.

RuedigerMueller
Advisor
Advisor
0 Kudos

Hi Saurav,

I just tried it with one of my activities and the "hello world" gadget. It worked without me doing anything special... So we can rule out a bug in the API.

When you "hellow world" gadget: did you enter some data in the text box and hit "update"? Is the text you entered displayed below the text box after the update? If you leave the activity and re-enter it: is the text still displayed below the text gadget?

I want to rule out that the problem is because your "hello world "method does not save the content.

Regards,

Rüdiger

saurav_das
Advisor
Advisor
0 Kudos

Hi Rüdiger

I think the gadget is working fine as the updated data is retaint and displayed when i start a new session.

I am not sure if i am using the API correctly. The document talks about the response content type.

In my header i am passing content-type: application/xml

here is a snipt of my request

https://streamwork.com/v1/items/5EXAbr-TgVCJV1qgL8-g1W/item_data?oauth_consumer_key=***********&oauth_token=*********&oauth_signature_method=PLAINTEXT&oauth_signature=*******%26***********&oauth_timestamp=1312945376&oauth_nonce=124&oauth_version=1.0

header:

Content-Type :application/xml

The response code is 400 (Bad Request)

and the response body

Thanks and Regards,

Saurav

RuedigerMueller
Advisor
Advisor
0 Kudos

Hi Saurav,

I am almost out of ideas...

The only difference between your request and the one which I send:

- I set content type in the header to "application/x-www-form-urlencoded"

- I pass the OAuth parameters in the header

Regards,

Rüdiger

Answers (1)

Answers (1)

saurav_das
Advisor
Advisor
0 Kudos

Finally the issue is resolved.

The issue was caused as I had used a plain name for the method

ModulePrefs name="example_name"

For some reason StreamWork was unable to identify my method.The issues got resolved after changing the name to include a package.

ModulePrefs name="com.test.example_name"

It is generally a good practice to package the content to maintain modularity and it seems not following that can lead into a lot of trouble as I found out the hard way .