-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[Bug] CLI task create call fails when the project is under an organization #4449
Comments
Yes, I have the same problem. Calling api/tasks with POST method does not allow to include a organization, but when you use GET method the organization field is included. I can't upload tasks via API when the project_id is under a organization. |
Please add |
I have tried this: I have an organization named 'Royo' so slug=Royo, I have the objective of creating a task using the api POST method. So in order to do that I have built the url for calling the api this way: http://localhost:8080/api/tasks?org=Royo Adding '?org=Royo' at the end of the url It works! |
While the REST API supports this, |
as explained above, with requests.Session() as session:
session.headers.update({'X-Organization':'org name'})
api = CVAT_API_V2('%s:%s' % (args.server_host, args.server_port), args.https)
cli = CLI(session, api, args.auth)
try:
actions[args.action](cli, **args.__dict__)
except (requests.exceptions.HTTPError,
requests.exceptions.ConnectionError,
requests.exceptions.RequestException) as e:
log.critical(e) |
@kimSooHyun950921 please could you elaborate on what code was changed to the code you have provided, and to what post above explained this Edit: Temp fix for anyone who needs help getting this working while using CVAT-CLI. you can change python3.9/site-packages/cvat_sdk/api_client/api_client.py in the ApiClient class, under the __call_api function, just before "# perform request and return response" you may add the following line: This will allow you to create tasks using the CLI by appending the required command at the end of your http request. hope this helps someone |
In the next release, the CLI will have an I'm not considering this issue fixed, though, since I think it would be useful for CVAT to automatically determine the organization when the task is linked to a project. That will need to be implemented in the server, rather than the CLI. |
The problem is the same when working with the Python high-level SDK. |
@hetfmt You can do this with the SDK already; just need to set the organization context. See https://opencv.github.io/cvat/docs/api_sdk/sdk/highlevel-api/#users-and-organizations. |
@SpecLad Excellent! Thank you! I just tested it, and it works like a charm :-) |
My actions before raising this issue
When I issue a POST call to
/api/tasks
to create a task under a certain project, it doesn't allow me to create it under the organization that the project belongs to, even though I, as the task creator, am part of said organization. (I used the CLI and also tried it in Swagger)Expected Behaviour
python cli.py --auth [...] create --project_id 2 [...]
should succeed when project with the supplied ID is under an organization that the user is authorized to create tasks for.Current Behaviour
The above call fails with status code 400 and the following error:
Steps to Reproduce (for bugs)
cli.py
to create a task for the project from the non-owner userThe text was updated successfully, but these errors were encountered: