API响应是html而不是Json

时间:2018-07-11 07:18:39

标签: json api curl postman

我正在尝试连接到FortiSandbox api guide here

指南摘录:

enter image description here

我的用户名:admin

我的密码:Aa12345!

cURL:

    curl -X POST \
  https://10.1.1.170/sys/login/user/ \
  -H 'accept: application/json' \
  -H 'cache-control: no-cache' \
  -H 'content-type: application/json' \
  -H 'postman-token: bd3ae694-f400-c723-8955-bfc4e96c8147' \
  -d '{
  "method": "exec",
  "params": [{
    "url": "/sys/login/user/",
    "data": [{
      "user": "admin",
      "passwd": "Aa12345!"
    }]
  }],
  "id": 1,
  "ver": "2.0"
}'

响应是HTML而不是Json here full HTML content response

plz为绝望的人提供建议 一些HTML响应:

<!DOCTYPE html>
<html lang="en">
    <head>
        <title>FortiSandbox - Please login</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        .
        .
        .

1 个答案:

答案 0 :(得分:1)

curl -X POST http://10.1.1.170/jsonrpc -H 'accept: application/json' -H 'cache-control: no-cache' -H 'content-type: application/json' -H 'postman-token: bd3ae694-f400-c723-8955-bfc4e96c8147' -d '{"method": "exec","params": [{"url": "/sys/login/user","data": [{"user": "admin","passwd": "Aa12345!"}]}],"id": 1,"ver": "2.0"}'