I Can't Add New Timelines To Ghosts Through API #271
-
A coworker of mine set up the Ghosts API while I've been working on the front end of our app. I can add new Machines through the API post request as well as retrieve them with a get request, but I can't add new timelines through Ghosts timeline post request. I don't get an error message, and it seems to work when I send the request. However, when I use the get request to pull down all the timelines in a machine, I just get an empty object. Nothing appears to be added despite the lack of an error message. Can anyone help me with this? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 32 replies
-
Hi, thanks for checking out the project. Hmm, it might be a couple of things — let's start with what you're posting as a timeline. Would you please post the json payload for POST to |
Beta Was this translation helpful? Give feedback.
-
Hmm, I think you have it right:
What you are seeing in wireshark is that the client makes a request to the server on 52550 and the latter returns 404. The client receives this on an ephemeral port (135 in this case), like this: client --> server:52550 -> responds with "404" --> received on client:135. couple of things to check:
|
Beta Was this translation helpful? Give feedback.
-
My apologies, I finally realized this morning what the issue is that you are pointing out! For {
"machineId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"type": "Timeline",
"activeUtc": "2024-03-23T13:39:44.558Z",
"status": "Active",
"update": {
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"status": "Run",
"timeLineHandlers": [
{
"handlerType": "BrowserFirefox",
"initial": "string",
"utcTimeOn": {
"ticks": 0
},
"utcTimeOff": {
"ticks": 0
},
"utcTimeBlocks": [
{
"ticks": 0
}
],
"handlerArgs": {
"additionalProp1": "string",
"additionalProp2": "string",
"additionalProp3": "string"
},
"loop": true,
"timeLineEvents": [
{
"trackableId": "string",
"command": "string",
"commandArgs": [
"string"
],
"delayAfter": "string",
"delayBefore": "string"
}
],
"scheduleType": "Other",
"schedule": "string"
}
]
}
} Any of the settings with "ticks" are timespans types, and they don't serialize properly for our purposes here in this method. I fixed this by explicitly creating a sample object that gets displayed now with version 8.0.7 of the container: {
"machineId": "8da92fc7-01af-4261-80e0-33539a7f251a",
"type": "TimelinePartial",
"activeUtc": "2024-03-23T14:14:37.411893Z",
"status": "Active",
"update": {
"id": "102d599b-df89-4ed5-891f-e0a09f14210e",
"status": "Run",
"timeLineHandlers": [
{
"handlerType": "BrowserFirefox",
"initial": "https://cmu.edu",
"utcTimeOn": "00:00:00",
"utcTimeOff": "23:59:59",
"utcTimeBlocks": null,
"handlerArgs": {},
"loop": true,
"timeLineEvents": [
{
"trackableId": null,
"command": "browse",
"commandArgs": [
"https://sei.cmu.edu"
],
"delayAfter": 30000,
"delayBefore": 0
}
],
"scheduleType": "Other",
"schedule": null
}
]
}
} Sorry for the confusion, I will try to be sure to check these swagger functions more closely with future updates. |
Beta Was this translation helpful? Give feedback.
My apologies, I finally realized this morning what the issue is that you are pointing out!
For
POST /api/machineupdates
the previously generated sample json payload was: