API - create a new list item

I Have a big deal whit a block: I need create a new list item in side Alexa whith API but every time give me a error.
The permision and the endpoit is correct.
I think that the problem is to compile the “HEADERS”, I have tried with many combinations but continues give me a error:

“ERROR”:{1 item
“message”:“src property must be a valid json object”

I cipiled in this mode
Enter HTTTP header: Authorization
Value: Bearer auth_token_for_customer

Enter object Path: Content-Type
Value: application/json

Please someone can help me?

you can download a demo from Voiceflow’s marketplace.

BTW, you seems Alexa List API, right? you should remeber some Alexa-specific features including list api, it can be tested only on Alexa Developer Console or real Echo device. those kind of features cannot be tested on Voiceflow’s test.

yes, the test I do in the Alexa developer but it fallied

Based on my knowledge, if the error is "message”:“src property must be a valid json object”, then the URL is probably not having a JAON structure. It must be having an HTML or other structure.

Cut and paste the API URL in a browser and check.

Also, which API is this - if I have experience in this I can assist…

Cheers

what i’m trying to do is write a list inside alexa. I composted the structure like this:
1- Block permision -lPermission request : lists write
2- Block user info - User info type : lists write
3-I go inside alexa and validate the authorizations
4-Block API - Request URL >: PUT https://api.amazonalexa.com/v2/householdlists/{NAME LISTS}/items/{NAME ITEM}
Header Assignments: Authorization
value: application/json

Did you check the demo on Voiceflow marketplace which I put above?

seems:

  • first you need to get a list id, not list name.
  • then you need to get an item id with the list id, not item name.

also, headers should be:

  • Content-Type: Application/Json
  • Authorization: Bearer api_token_got_from_request

https://developer.amazon.com/en-US/docs/alexa/custom-skills/access-the-alexa-shopping-and-to-do-lists.html#alexa-lists-access

ok thank you very much i am solving following the demo, but i don’t understand something:

In the API block “get shoping list” I retrieve the shopping list into “transform into varibles” whit the numer [0], but I want to retrieve a specific name from my list. How can I do?

I’ve not tried, so just my idea and example.

  • put whole response(response.list) into one single variable(lists)
  • get a list name from user and into a variable(user_list_name)
  • use code block to find a list matched with user’s utterance, and put it into voiceflow’s variable. should be like this.
list = lists.find((l) => l.name === user_list_name);
// get id from list and put into voiceflow's variable
listid = list.id

according to the Amazon’s official document,

  • list metadata api returns the whole lists including user’s custom lists and default shopping list and to-do list.
  • seems default shopping-list is always first, to-do list is 2nd, in the whole lists. (That’s why demo use response.lists[0].listid)

https://developer.amazon.com/en-US/docs/alexa/custom-skills/access-the-alexa-shopping-and-to-do-lists.html#getListsMetadata

one more thing. This is just my opinion. It might be hard to get customer’s custom list by its name by voice because Alexa might not recognize its list name correctly.

ex) when you say ‘to-do list’, alexa seems recognize ‘to do list’. you know what i mean.

anyway, you should try.