Skip to content

Conversation

@kyteinsky
Copy link
Contributor

Summary

The OCS task processing endpoints require a user to be present even if the requests are coming from ExApps using AppAPI's authentication. This makes it a requirement to choose a user on the instance for scheduling and querying tasks from an ExApp, and choosing that user can be difficult in some cases or the user may not be present so this provides a way for ExApps to access the API without any user involved (userId === null).
Since the API was designed to work without the requirement of any user (for the most part, see passing files in schedule endpoint), this works nicely and also does not allow anonymous user access.

Endpoints added:

  • schdule task
  • get task
  • cancel task
  • delete task
  • get task types

Should listTasksByApp and listTasks be added? They're not required as of now.

Python code that can be used for testing, needs the ExApp env vars though
import os

os.environ["NPA_NC_CERT"] = "false"

from nc_py_api import NextcloudApp

nc = NextcloudApp()
# nc.set_user("admin")
try:
	# schedule

	# r = nc.ocs(
	# 	"POST",
	# 	"/ocs/v2.php/taskprocessing/tasks_consumer/schedule",
	# 	json={
	# 		"type": "core:text2text:translate",
	# 		"appId": os.getenv("APP_ID", "live_transcription"),
	# 		"customId": f"lt_startup_test_{os.urandom(4).hex()}",
	# 		"input": {
	# 			"input": "Hola, world!",
	# 			"origin_language": "en",
	# 			"target_language": "hi",
	# 		},
	# 	},
	# )

	# get

	# r = nc.ocs(
	# 	"GET",
	# 	"/ocs/v2.php/taskprocessing/tasks_consumer/task/238",
	# )

	# cancel

	# r = nc.ocs(
	# 	"POST",
	# 	"/ocs/v2.php/taskprocessing/tasks_consumer/tasks/238/cancel",
	# )

	# delete

	# r = nc.ocs(
	# 	"DELETE",
	# 	"/ocs/v2.php/taskprocessing/tasks_consumer/task/238",
	# )

	# list task types

	r = nc.ocs(
		"GET",
		"/ocs/v2.php/taskprocessing/tasks_consumer/tasktypes",
	)

	print("taskprocessing response:", r, flush=True)
except Exception as e:
	print("Failed to connect to Nextcloud", e)

TODO

  • ...

Checklist

@kyteinsky kyteinsky added the php Pull requests that update Php code label Jan 7, 2026
@kyteinsky kyteinsky requested a review from a team as a code owner January 7, 2026 10:34
@kyteinsky kyteinsky requested review from ArtificialOwl, come-nc and icewind1991 and removed request for a team January 7, 2026 10:34
@kyteinsky kyteinsky force-pushed the feat/exapp-task-proc-endpoints branch from dda7fd7 to d838c65 Compare January 7, 2026 11:04
@kyteinsky kyteinsky changed the title feat(TaskProcessing): add endpoints for ExApp access without user con… feat(TaskProcessing): add endpoints for ExApp access without userId Jan 7, 2026
@kyteinsky kyteinsky force-pushed the feat/exapp-task-proc-endpoints branch 2 times, most recently from 56075a5 to 74ac6fa Compare January 7, 2026 12:27
Copy link
Member

@julien-nc julien-nc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

Signed-off-by: Anupam Kumar <kyteinsky@gmail.com>
@kyteinsky kyteinsky force-pushed the feat/exapp-task-proc-endpoints branch from 74ac6fa to 3e4e544 Compare January 8, 2026 06:09
@kyteinsky kyteinsky mentioned this pull request Jan 8, 2026
@Altahrim Altahrim merged commit a1fbd55 into master Jan 8, 2026
215 of 221 checks passed
@Altahrim Altahrim deleted the feat/exapp-task-proc-endpoints branch January 8, 2026 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature: TaskProcessing php Pull requests that update Php code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants