10

Hello,

I am trying to create a shortcut to use the TubeArchivist api to archive YouTube videos. I've tried to send the request as text but it doesn't work because it expects an array I guess? I've gotten the request to work using CURL on the command line but when I try to add a value to an array in shortcuts the field is locked and won't accept any input.

I've done some searching across the wider internet for how to construct arrays in shortcuts but no matter what I attempt that field is always locked. Can it not accept any inputs? Confused how to actually put my structured data into it.

The URL that comes before it is the local host and port of the TubeArchivist server API endpoint.

top 5 comments
sorted by: hot top controversial new old
[-] 2xsaiko@discuss.tchncs.de 1 points 3 months ago

What do you mean the value is locked? I can add items just fine.

[-] rastacalavera@lemmy.world 1 points 3 months ago

I am trying to create a shortcut to use the TubeArchivist api to archive YouTube videos. I’ve tried to send the request as text but it doesn’t work because it expects an array I guess? I’ve gotten the request to work using CURL on the command line but when I try to add a value to an array in shortcuts the field is locked and won’t accept any input.

I’ve done some searching across the wider internet for how to construct arrays in shortcuts but no matter what I attempt that field is always locked. Can it not accept any inputs? Confused how to actually put my structured data into it.

The URL that comes before it is the local host and port of the TubeArchivist server API endpoint.

OMG. So my phrasing was not great. The "Get" was for the shortcut not the intended Method. Your screenshot helped me to see how to construct the array though . . . if my command line argument looks like this '{"data": [{"youtube_id": "dH_crMm_7Po", "status": "pending"}]}' would I need 3 separate items? I think I have something to play with and test now :)

[-] 2xsaiko@discuss.tchncs.de 1 points 3 months ago

Kinda, data here is an array with one item, a dictionary, and that dictionary has 3 items.

[-] towerful@programming.dev 1 points 3 months ago* (last edited 3 months ago)

I have no idea, but you say it's a GET request, but the screenshot shows a POST request.
If it's supposed to be a GET request, then the array needs to be encoded specific to the backend as there is no standardised way of passing an array in a query string (and it has to be query string because GET requests don't have a body).

https://stackoverflow.com/questions/6243051/how-to-pass-an-array-within-a-query-string

What is the cURL command you have used that works? It might make it clear what isn't working

[-] rastacalavera@lemmy.world 1 points 3 months ago

So I have a working solution! Might not be the most efficient but it works!

this post was submitted on 29 Jul 2024
10 points (100.0% liked)

Shortcuts

1055 readers
1 users here now

Community dedicated to Apple Shortcuts.

founded 1 year ago
MODERATORS