X-callback-url get not appending the return param


#1

Hi,

I’m trying to get a draft in pythonista from pythonista through the x-callback-url. After some experimenting the code works, but the return argument and value is never appended.

webbrowser.open('drafts5://x-callback-url/get?uuid=E2B978CB-7E2C-4EC5-A4F4-2E4B099C87CE&retParam=argv&x-success=pythonista%3A//Drafts/Template-Vergader%3Faction%3Drun')

Am I doing something wrong or is there a bug?
The UUID is valid as drafts opens the draft.


#3

Yeah that should be the behaviour, according to the documentation:

/get
Return the current content of the draft specified by the UUID argument as an argument to the x-success URL provided.

Arguments
uuid [string, required] : The UUID identifier for a draft.
retParam [string, optional] : The name of the argument to use to pass the draft content back to the x-success URL. Defaults to “text”, but if the requesting app expects another value (like Workflow’s “input”) use this argument to override.
Examples
drafts5://x-callback-url/get?uuid=UUID-TO-VALID-DRAFT&x-success=APP-URL
Retrieves the content of the identified draft, and calls the x-success URL with the argument text=DRAFT-CONTENT added.

my try

drafts5://x-callback-url/get?uuid=E2B978CB-7E2C-4EC5-A4F4-2E4B099C87CE&retParam=argv&x-success=pythonista%3A//Drafts/Template-Vergader%3Faction%3Drun

So instead of text as return parameter it should give argv, however no such luck, it doesn’t return anything.


#4

I get this with a basic test via Workflow.

Drafts (latest beta release) triggers fine. The uuid is correct as switching to just use it for an open URL action works, but it does seem like nothing coming back from Drafts.


#5

Looks like you found a bug. Just reviewing this and there’s a gap appending return parameters to the x-success URL if the x-success URL does not have any parameters to begin with.

I’ll fix this for the next update, but in the meantime you can workaround by adding a parameter to the x-success URL - it will get ignored by the target app, but will workaround the bug - something like &a=b.


#6

Ok i’m not crazy :smile: it’s a bug.
I understand the workaround, unfortunately for Pythonista this doesn’t work as it expects either an arg or argv where the parameters are at. An unknown parameter is not only ignored, it ignores what comes next . At least it seems like that on how my code behaves.