Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get the space ID a task or task container is associated with. #34

Closed
avillaindesire opened this issue Oct 24, 2020 · 2 comments
Closed

Comments

@avillaindesire
Copy link

Space URL is passed as a property of a task (task -> content -> metadata -> URL), but it doesn't look like the space ID is anywhere in the task. Is there a way to find tasks associated with a space besides parsing that URL and iterating through all the tasks? Ideally, I'd be able to supply a space ID and either get the container ID or tasks associated with it.

@avillaindesire
Copy link
Author

avillaindesire commented Oct 24, 2020

Looking into it a little further, I don't actually see a way to figure out the container ID for a space that has no tasks. there isn't an api/v1/tasks/container endpoint that lists all of the containers. Since Container ID is a required parameter for many of the endpoints, it seems like that would be more interesting to have. Maybe add the space ID into that call?

Edit: Sorry to keep banging on this. I'm new to programming and I'm trying to use this as a way to learn REST APIs. Digging a little deeper, I learned that the contentcontainer_id is actually unique to the space. So it would make more sense overall to expose that property in spaces. I've worked around it for now by adding the contentcontainer_id as a tag after creating the space (I'm not using tags for anything else), but it's not a solution that would work for everyone... Thanks!

Edit 2: Last edit, I swear. I figured out that I could just add it to the SpaceDefinitions.php file. I added this line to the getSpace function: 'contentcontainer_id' => $space->contentcontainer_id,

@luke-
Copy link
Contributor

luke- commented Oct 26, 2020

The Rest API is unfortunately still not complete or optimal in some places.

At this time you can fetch all content containers via following call:
https://www.humhub.com/en/marketplace/rest/docs/html/content.html#tag/Container/paths/~1content~1container/get
You may need to filter the object_class to 'Spaces' only.

However, it would be nicer if space/user metadata also contain their ContentContainer ID.
I've created an issue here: #35

I've you like you're welcome to create a PR for this!

@luke- luke- closed this as completed Oct 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants