AutoWeb Spotify API INPUT Array

Discussion in 'AutoApps' started by ratelutz, Mar 23, 2019.

  1. ratelutz

    ratelutz New Member

    Joined:
    Apr 23, 2017
    Messages:
    12
    Likes Received:
    0
    I'm trying to extend the Spotify API with endpoint "Transfer User's Playback". The API requires the device_id to be passed as an array but i can not figure out how to do this.

    can anybody tell me how to format the INPUT to pass a array?
     
  2. ratelutz

    ratelutz New Member

    Joined:
    Apr 23, 2017
    Messages:
    12
    Likes Received:
    0
    No one?
     
  3. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    Hi. It works just like any other json body. :) Check out any other endpoint that requires a json body to see an example. Check here for documentation.
     
  4. ratelutz

    ratelutz New Member

    Joined:
    Apr 23, 2017
    Messages:
    12
    Likes Received:
    0
  5. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    Can you please enable system logs and check what AutoWeb is sending?
     
  6. ratelutz

    ratelutz New Member

    Joined:
    Apr 23, 2017
    Messages:
    12
    Likes Received:
    0
    I have System Logs allready enabled, but were can i find the log? Log Listing ist empty
     
  7. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    In AutoWeb itself > Logs :)
     
  8. ratelutz

    ratelutz New Member

    Joined:
    Apr 23, 2017
    Messages:
    12
    Likes Received:
    0
    Here is the Log:
    version 1.0b.bf3

    OS Build ONEPLUS A6013_41_190123
    OS Code 28
    Device ONEPLUS A6013
    Manufacturer OnePlus
    Product OnePlus6T

    Api Calls - 2019-03-25 19:10:54.782 - Calling PUT: https://api.spotify.com/v1/me/player?market=US
    Api Calls - 2019-03-25 19:10:54.782 - Sending body:
    {
    "device_ids": [
    "
    =:==:=

    "
    ]
    }
    Api Calls - 2019-03-25 19:07:11.548 - Sending body:
    {
    "device_ids": [
    "0a3a70ec602cbfefe5c4bbf7db6fb7501825d5b5"
    ]
    }
    Api Calls - 2019-03-25 19:07:11.547 - Calling PUT: https://api.spotify.com/v1/me/player?market=DE
    Api Calls - 2019-03-25 19:03:38.362 - Calling PUT: https://api.spotify.com/v1/me/player?market=US
    Api Calls - 2019-03-25 19:03:38.362 - Sending body:
    {
    "device_ids": [
    "0a3a70ec602cbfefe5c4bbf7db6fb7501825d5b5"
    ]
    }
    Api Updates - 2019-03-25 19:03:21.583 - Subscribed to API updates
     
    Last edited: Mar 25, 2019
  9. ratelutz

    ratelutz New Member

    Joined:
    Apr 23, 2017
    Messages:
    12
    Likes Received:
    0
    Hi Joao,

    the log output looks now like this:

    Sending body:
    {
    device_ids:[
    "
    0a3a70ec602cbfefe5c4bbf7db6fb7501825d5b5
    "
    ]
    }


    But i still getting
    Error: 317504052
    {"error":{ "status":400, "message":"Malformed json" }}


    Any idea whats wrong?
     
  10. ratelutz

    ratelutz New Member

    Joined:
    Apr 23, 2017
    Messages:
    12
    Likes Received:
    0
    fixed it.
    the spotify endpoint does not like the new lines. the complete body string has to be in one line
     
  11. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    Glad you got it :D Did you submit the updated version to AutoWeb's server?
     
  12. ratelutz

    ratelutz New Member

    Joined:
    Apr 23, 2017
    Messages:
    12
    Likes Received:
    0
    How to do it?
     
  13. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    It should show you a notification to submit it after having ran the action successfully. Did you not get it?
     
  14. ratelutz

    ratelutz New Member

    Joined:
    Apr 23, 2017
    Messages:
    12
    Likes Received:
    0
    No i don't. I think it is because the "generate output" failes with "device_id is missing" because the api endpoint expects a real device_id
    In the INPUT i have %aid as variable ant the api can not understand this.
    i have my recent spotify api exported and attached. maybe you can check it and modify so every one can use it
     

    Attached Files:

  15. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    Cool :D Just imported that and now everyone should be able to use it :)
     
  16. ratelutz

    ratelutz New Member

    Joined:
    Apr 23, 2017
    Messages:
    12
    Likes Received:
    0
    Hey Joa,
    i just checked the updated API and realised that i forgot to set the correct description text. Please correct the description to
    "Transfer a user's Playback to a specific device"
     
  17. joaomgcd

    joaomgcd Administrator Staff Member

    Joined:
    Feb 3, 2015
    Messages:
    9,479
    Likes Received:
    806
    Ok, done :D thanks!
     
: SPOITIFY, AUTOWEB

Share This Page