Another Curl to Restful Conversion :(

Hi All, I am attempting at getting this curl sequence to a restful post sensor but I keep hitting walls and decided to reach out for guidance, any help is appreciated.
CURL

curl -X 'POST' \
  'http://192.168.1.140:8888/unmanic/api/v2/pending/tasks' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "start": 0,
  "length": 10,
  "search_value": "items with this text in the value",
  "status": "all",
  "after": "2022-04-07 01:45",
  "before": "2022-04-07 01:55",
  "order_by": "priority",
  "order_direction": "desc"
}'

Returns this

{"recordsTotal": 787, "recordsFiltered": 0, "results": []}

I am looking to grab the recordsTotal numerical value into a sensor

I have tried variations of this with no luck

  - platform: rest
    resource: http://192.168.1.140:8888/unmanic/api/v2/pending/tasks
    method: POST
    headers:
      content-type: "application/json"
      accpet: "application/json"
    payload: ' "start": 0,  "length": 10,  "search_value": "items with this text in the value",  "status": "all",  "after": "2022-04-07 01:45",  "before": "2022-04-07 01:55",  "order_by": "priority",  "order_direction": "desc"}'
    name: unmanic_tasks
    unit_of_measurement: '#'
    unique_id: umtasksq
    value_template: "{{ value_json.recordsTotal }}"
- platform: command_line  
    command: 'curl -X POST \ http://192.168.1.140:8888/unmanic/api/v2/pending/tasks \ -H "accept: application/json" \  -H "Content-Type: application/json" \  -d "{  "start": 0,  "length": 10,  "search_value": "items with this text in the value",  "status": "all",  "after": "2022-04-07 01:45",  "before": "2022-04-07 01:55",  "order_by": "priority",  "order_direction": "desc"}"'
    name: unmanic_tasks
    unit_of_measurement: '#'
    unique_id: umtasksq
    value_template: "{{ value_json.recordsTotal }}"
    scan_interval: 20
    command_timeout: 30

ETC…

You are missing the opening brace from your payload, {

payload: '{ "start": 0,  "length": 10,  "search_value": "items with this text in the value",  "status": "all",  "after": "2022-04-07 01:45",  "before": "2022-04-07 01:55",  "order_by": "priority",  "order_direction": "desc"}'

Also, accept: instead of accpet:

2 Likes

:face_in_clouds:
You guys rock TYVM, LOL i cant believe i miss spelled that TY