Hi steinar,
while creating the webui, i was not able to figure out how the "Abort Job" API works, i always got strange "empty" answers
When setting this url for a valid, running job in the browser, i get a text presented: Invalid resource : "/api/json/v1/jobs/20181216-195117-270-5355A49682BE"
Here an example that should work when you run ffastrans on default port, it basically proves that using jsfiddle works (as you enable CORS thankfully):
Hit the "make request" link bottom right: https://jsfiddle.net/p5nryj72/
Here an example for the actual DELETE request that should abort a job. Sure you need to change the jobid in the botton left window but for me this does not succeed:
https://jsfiddle.net/643vLxs0/2/
To be honest, i am not 100% sure if i do anything wrong but i am confident that the error is reproduceable easily.
A sidenote, i am not very experienced with other http methods than GET and POST, usually it just works as expected. I personally dislike the use of different http methods, it overcomplicates things. Instead i just go with either url parameters or http header parameters and such.
Cheers,
emcodem
API call "Abort job" does not work for me
API call "Abort job" does not work for me
emcodem, wrapping since 2009 you got the rhyme?
Re: API call "Abort job" does not work for me
I think you must be doing something wrong. I just tried jusing POSTMAN (https://www.getpostman.com/) and it definately works using the DELETE method. I'm trying to do the "right thing" when it comes to using different methods but I can see using other than GET and POST might be cumbersome. At the same time, sending a DELETE to a job seem to be logical (and easy) and no extra payload (JSON body) is needed.
Anyway, here's the output from the rest_service when you send your delete command:
OPTIONS /api/json/v1/jobs/20181216-195117-270-5355A49682BE HTTP/1.1
Host: localhost:65445
Connection: keep-alive
Origin: https://fiddle.jshell.net
Access-Control-Request-Method: DELETE
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36
Accept: */*
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9,nb;q=0.8,da;q=0.7
As you see, you have OPTIONS as method and DELETE is set in the "Access-Control-Request-Method", which the service currently does not understand. The following is from POSTMAN (and working):
DELETE /api/json/v1/jobs/20181216-225722-643-F1235D5E7DF1 HTTP/1.1
Host: localhost:65445
Connection: keep-alive
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36
Cache-Control: no-cache
Origin: chrome-extension://fhbjgbiflinjbdggehcddcbncdddomop
Postman-Token: 1128aa28-75c4-7021-eea8-8e8d237481d5
Content-Type: application/json;charset=UTF-8
Accept: */*
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9,nb;q=0.8,da;q=0.7
-steinar
Anyway, here's the output from the rest_service when you send your delete command:
OPTIONS /api/json/v1/jobs/20181216-195117-270-5355A49682BE HTTP/1.1
Host: localhost:65445
Connection: keep-alive
Origin: https://fiddle.jshell.net
Access-Control-Request-Method: DELETE
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36
Accept: */*
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9,nb;q=0.8,da;q=0.7
As you see, you have OPTIONS as method and DELETE is set in the "Access-Control-Request-Method", which the service currently does not understand. The following is from POSTMAN (and working):
DELETE /api/json/v1/jobs/20181216-225722-643-F1235D5E7DF1 HTTP/1.1
Host: localhost:65445
Connection: keep-alive
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36
Cache-Control: no-cache
Origin: chrome-extension://fhbjgbiflinjbdggehcddcbncdddomop
Postman-Token: 1128aa28-75c4-7021-eea8-8e8d237481d5
Content-Type: application/json;charset=UTF-8
Accept: */*
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9,nb;q=0.8,da;q=0.7
-steinar
Re: API call "Abort job" does not work for me
Ah, i suspect i know what this is about... as i use the Browser the OPTIONS call is automatically added for CORS communication. Working around by using a proxy to my own webserver which forwards the request might help. I hope node.js can do that...
emcodem, wrapping since 2009 you got the rhyme?
Re: API call "Abort job" does not work for me
I have improved support for the OPTIONS method in the next version. Currently now tested with POSTMAN and working.
-steinar
-steinar
Re: API call "Abort job" does not work for me
Hah great stuff, i can confirm in the beta the OPTIONS works, thanks, that makes life easy
Funny that the browser generated this special call only for the DELETE method...
By the way, I was also able to workaround by proxying the call through my webserver which i guess is the preferred method for communicating with the API anyway. Using a proxy allows the client to communicate with a single server instead of 2 - in case the webui is not installed on the same machine as ffastrans.
Cheers,
emcodem
Funny that the browser generated this special call only for the DELETE method...
By the way, I was also able to workaround by proxying the call through my webserver which i guess is the preferred method for communicating with the API anyway. Using a proxy allows the client to communicate with a single server instead of 2 - in case the webui is not installed on the same machine as ffastrans.
Cheers,
emcodem
emcodem, wrapping since 2009 you got the rhyme?