代码之家  ›  专栏  ›  技术社区  ›  coreyg

curl get忽略了浏览器中显示的json

  •  0
  • coreyg  · 技术社区  · 6 年前

    当我转到以下url时:

    http://localhost:8090/rest/api/content/search?cql=label+%3D+%22program-status-rollup-employee%22&expand=space

    我得到以下JSON:

        {
    "results": [
    {
    "id": "2064397",
    "type": "page",
    "status": "current",
    "title": "TL Employee Reports",
    "space": {
    "id": 98306,
    "key": "COM",
    "name": "Compass",
    "type": "global",
    "_expandable": {
    "metadata": "",
    "icon": "",
    "description": "",
    "homepage": "/rest/api/content/65584"
    },
    "_links": {
    "self": "http://localhost:8090/rest/api/space/COM",
    "webui": "/display/COM"
    }
    },
    "extensions": {
    "position": "none"
    },
    "_expandable": {
    "container": "/rest/api/space/COM",
    "metadata": "",
    "operations": "",
    "children": "/rest/api/content/2064397/child",
    "restrictions": "/rest/api/content/2064397/restriction/byOperation",
    "history": "/rest/api/content/2064397/history",
    "ancestors": "",
    "body": "",
    "version": "",
    "descendants": "/rest/api/content/2064397/descendant"
    },
    "_links": {
    "self": "http://localhost:8090/rest/api/content/2064397",
    "webui": "/display/COM/TL+Employee+Reports",
    "edit": "/pages/resumedraft.action?draftId=2064397&draftShareId=0906da34-3930-4c15-8339-d85c309f6cc0",
    "tinyui": "/x/DYAf"
    }
    },
    {
    "id": "2064402",
    "type": "page",
    "status": "current",
    "title": "Employee Reports",
    "space": {
    "id": 2162689,
    "key": "NC",
    "name": "New Compass",
    "type": "global",
    "_expandable": {
    "metadata": "",
    "icon": "",
    "description": "",
    "homepage": "/rest/api/content/2064389"
    },
    "_links": {
    "self": "http://localhost:8090/rest/api/space/NC",
    "webui": "/display/NC"
    }
    },
    "extensions": {
    "position": "none"
    },
    "_expandable": {
    "container": "/rest/api/space/NC",
    "metadata": "",
    "operations": "",
    "children": "/rest/api/content/2064402/child",
    "restrictions": "/rest/api/content/2064402/restriction/byOperation",
    "history": "/rest/api/content/2064402/history",
    "ancestors": "",
    "body": "",
    "version": "",
    "descendants": "/rest/api/content/2064402/descendant"
    },
    "_links": {
    "self": "http://localhost:8090/rest/api/content/2064402",
    "webui": "/display/NC/Employee+Reports",
    "edit": "/pages/resumedraft.action?draftId=2064402&draftShareId=8fb3e862-e52f-498d-83d5-6b6046682070",
    "tinyui": "/x/EoAf"
    }
    },
    {
    "id": "819224",
    "type": "page",
    "status": "current",
    "title": "Employee Reports",
    "space": {
    "id": 98306,
    "key": "COM",
    "name": "Compass",
    "type": "global",
    "_expandable": {
    "metadata": "",
    "icon": "",
    "description": "",
    "homepage": "/rest/api/content/65584"
    },
    "_links": {
    "self": "http://localhost:8090/rest/api/space/COM",
    "webui": "/display/COM"
    }
    },
    "extensions": {
    "position": "none"
    },
    "_expandable": {
    "container": "/rest/api/space/COM",
    "metadata": "",
    "operations": "",
    "children": "/rest/api/content/819224/child",
    "restrictions": "/rest/api/content/819224/restriction/byOperation",
    "history": "/rest/api/content/819224/history",
    "ancestors": "",
    "body": "",
    "version": "",
    "descendants": "/rest/api/content/819224/descendant"
    },
    "_links": {
    "self": "http://localhost:8090/rest/api/content/819224",
    "webui": "/display/COM/Employee+Reports",
    "edit": "/pages/resumedraft.action?draftId=819224&draftShareId=0df4eb62-9bb6-4532-a445-4002695dcb90",
    "tinyui": "/x/GIAM"
    }
    }
    ],
    "start": 0,
    "limit": 25,
    "size": 3,
    "_links": {
    "base": "http://localhost:8090",
    "context": "",
    "self": "http://localhost:8090/rest/api/content/search?expand=space&cql=label+%3D+%22program-status-rollup-employee%22"
    }
    }
    

    http://localhost:8090/rest/api/content/search?cql=label+%3D+%22程序状态汇总员工%22&expand=空间

    我没有得到所有的信息:

        {  
       "results":[  
          {  
             "id":"2064397",
             "type":"page",
             "status":"current",
             "title":"TL Employee Reports",
             "restrictions":{  
    
             },
             "_expandable":{  
                "container":"",
                "metadata":"",
                "extensions":"",
                "operations":"",
                "children":"",
                "history":"/rest/api/content/2064397/history",
                "ancestors":"",
                "body":"",
                "version":"",
                "descendants":"",
                "space":"/rest/api/space/COM"
             },
             "_links":{  
                "self":"http://localhost:8090/rest/api/content/2064397",
                "webui":"/display/COM/TL+Employee+Reports",
                "tinyui":"/x/DYAf"
             }
          },
          {  
             "id":"2064402",
             "type":"page",
             "status":"current",
             "title":"Employee Reports",
             "restrictions":{  
    
             },
             "_expandable":{  
                "container":"",
                "metadata":"",
                "extensions":"",
                "operations":"",
                "children":"",
                "history":"/rest/api/content/2064402/history",
                "ancestors":"",
                "body":"",
                "version":"",
                "descendants":"",
                "space":"/rest/api/space/NC"
             },
             "_links":{  
                "self":"http://localhost:8090/rest/api/content/2064402",
                "webui":"/display/NC/Employee+Reports",
                "tinyui":"/x/EoAf"
             }
          },
          {  
             "id":"819224",
             "type":"page",
             "status":"current",
             "title":"Employee Reports",
             "restrictions":{  
    
             },
             "_expandable":{  
                "container":"",
                "metadata":"",
                "extensions":"",
                "operations":"",
                "children":"",
                "history":"/rest/api/content/819224/history",
                "ancestors":"",
                "body":"",
                "version":"",
                "descendants":"",
                "space":"/rest/api/space/COM"
             },
             "_links":{  
                "self":"http://localhost:8090/rest/api/content/819224",
                "webui":"/display/COM/Employee+Reports",
                "tinyui":"/x/GIAM"
             }
          }
       ],
       "start":0,
       "limit":25,
       "size":3,
       "_links":{  
          "base":"http://localhost:8090",
          "context":"",
          "self":"http://localhost:8090/rest/api/content/search?cql=label+%3D+%22program-status-rollup-employee%22"
       }
    }
    

    具体来说,它忽略了空间物体,我需要它。有什么想法吗?

    1 回复  |  直到 6 年前
        1
  •  0
  •   coreyg    6 年前

    我需要用单引号避开“与”号。一旦我这么做了,它就会返回我在浏览器中看到的json

    http://localhost:8090/rest/api/content/search?cql=label+%3D+%22program-status-rollup-employee%22 '和'expand=空间