-
Notifications
You must be signed in to change notification settings - Fork 386
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
API Call "create_event" problem #635
Comments
Gotta use proper JSON inside your POST data, so you can set data types (e.g. boolean for enabled): {"title":"ansible","category":"clen7h745","plugin":"plm6f5u70","target":"h2","enabled":true} So try this:
|
You might also need to set the |
It works, also giving a json file, with this curl: curl -d @data.json -X POST http://IP:3012/api/app/create_event/v1 -H "X-API-Key: 5eb8sdfdfdfsdfgrded65d5479a685" --header "Content-Type: application/json" Any idea to not have the event duplicated every time that i run a ansible role with with this API call? Thanks a lot! |
Well, I don't know anything about Ansible, but the API call is named |
So imagine that is a bash script, that i will run from time to time. This means that every time that i run, it will create a duplicated event. I wonder if there is a way to not let it create a event that is exactly like other that already exists or if there is a way to remove all the duplicated events. |
I dunno, it sounds like you are doing something that Cronicle isn't really designed to handle. Your bash script sounds like it's more of a "bootstrap" -- an "initialization" routine -- that should only be called once when you are setting up your environment. You may need a more involved script that calls get_event to see if your event already exists, and it does, skip the Another option is, you could have your script call delete_event before it calls |
I though about the 2 options, get and delete, is a lot of work, maybe i will try other time. Thanks a lot for the help. |
Summary
When you try to create a event, via API, you get:
{"code":"api","description":"Malformed parameter type: enabled (string)"}
Looks like the problem is similar to #626
Steps to reproduce the problem
Create user via api, like for example:
curl -d "title=ansible&category=clfdfs745&plugin=pleewru70&target=t2&enabled=1" -X POST http://IP:3012/api/app/create_event/v1 "X-API-Key: 5eb8ccc69ca0arggdfgfddf65d5479a685"
Your Setup
1x master
3x workers
Operating system and version?
Ubuntu 20.04
Node.js version?
v18.17.1
Cronicle software version?
Version 0.9.30
Are you using a multi-server setup, or just a single server?
Multi-server, but single master
Are you using the filesystem as back-end storage, or S3/Couchbase?
No
Can you reproduce the crash consistently?
Yes
Log Excerpts
curl -d "title=ansible&category=clen7h745&plugin=plm6f5u70&target=h2&enabled=1" -X POST http://IP:3012/api/app/create_event/v1 -H "X-API-Key: 5eb8ccc69caertretertq3ade65d5479a685"
{"code":"api","description":"Malformed parameter type: enabled (string)"}
The text was updated successfully, but these errors were encountered: