cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Error 400 Job scheduler with CAP service

0 Likes
2,012

Hello everyone,

I have this error 400 when I try to call my endpoint created with cap serivice with the jobscheduler.

I have followed the steps in this blog but I am getting the problem.

I have been investigating and it seems that in the call that makes the jobscheduler to my endpoint is not passing in the header the content type: application/json, If you look at the pictures I did the test with my postman and the same error appears if I remove the content type to the request, is there any way to add the content type: application/json in the call that makes the jobscheduler ?

If someone can give me a hand, it would be of great help.

Thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

0 Likes

I have managed to solve the problem, basically in my definition of the service.cds I had an action associated to that endpoint which I called from the jobsechuler.

I have changed that action by a function since I didn't need to send any type of data to the service and I have configured it by means of the get call.

According to the documentation of the api if we declare an action, this will need a header application/json to be able to make the call since we will send data, in the body of the request. Then it is necessary to declare it. I don't know how to add that header using an action through the jobscheduler, but the only thing I could think of was to create a kind of midelware that would add the header forcing every time it enters in my api but I couldn't make it work. I think the Job Scheduler service is quite limited and should get some updates.

I hope you found my experience useful.

Best regards.

Answers (1)

Answers (1)

MMonis
Participant
0 Likes

I had the same error if the job scheduler calls an action endpoint with POST.

If you set the Data field to an empty json in the scheduler, it works fine.

Regards,

Melwyn

Swetha__Balusamy
Participant
0 Likes
I am also facing the same issue. Unable to send dynamic input to my action in CAP from job scheduler