Params Does not Work when is pased to schedule a Job
andresmelian opened this issue · comments
Im Trying to create a Job with a Basic URL and schedule this Job using params to not repeat the same Job with different Params, but I check an the params are not sending like that into the schedule.
http://localhost:4040/api/job/now
This is the Body I sent:
{
"name": "SapUp",
"data": {
"params":
{
"vm_name": "NVD-PW-CA5-SAP-VT-11",
"instance": "nn",
"ticket":"TICKETTEST08",
"mail":"andres.melian@cositas.com"
}
}
}
This is the Job Definition Im Using
{
"_id" : ObjectId("5d1638e15f48de2af1aace10"),
"name" : "SapUp",
"url" : "https://webstation.cositas.com:3700/api/sap_up",
"method" : "POST"
}
the errror Im Recieving is
{
"_id" : ObjectId("5d163962bbc6042b04da0fe4"),
"name" : "SapUp",
"data" : {
"params" : {
"vm_name" : "NVD-PW-CA5-SAP-VT-11",
"instance" : "nn",
"ticket" : "TICKETTEST08",
"mail" : "andres.melian@cositas.com"
}
},
"type" : "normal",
"priority" : 0,
"nextRunAt" : null,
"lastModifiedBy" : null,
"lockedAt" : null,
"lastRunAt" : ISODate("2019-06-28T15:59:32.224Z"),
"failCount" : 1,
"failReason" : "406 - {"id":406,"msg":"Debe ingresar vm_name"}", (Is Not recieving this Param)
"failedAt" : ISODate("2019-06-28T15:59:32.379Z"),
"lastFinishedAt" : ISODate("2019-06-28T15:59:32.379Z")
Is this an Issue of the agenda-rest or Im using wrong the npm.
Best regards
Andres
@andresmelian : Your job definition url seems to be https://webstation.cositas.com:3700/api/sap_up
. It does not include the expected param names. Shouldn't your url in the job definition be https://webstation.cositas.com:3700/api/sap_up/:vm_name/:instance/:ticket/:mail
?
We should probably close this issue. I have tested this code and it works as designed. Is there another reason to keep it opened?
I should add some unit tests for this. @keyvan-m-sadeghi Is that OK?
@keyvan-m-sadeghi I added the unit tests to test this functionality. I think we can close this thicket when #73 is merged.
@andresmelian You can take a look at the relevant unit test for this feature here:
Lines 159 to 167 in 62dd72e
Great to hear, thanks @geosp 🎉
Closing as #73 is now merged.