• graphql接口测试记录


    graphql的视频讲解大概在这个地方:https://ninghao.net/video/8029#info 

    https://wiki.prometheanjira.com/display/PANM/How+to+send+request+from+GraphQL+playground    

    可能回迁移到下面这个地址

    https://start.atlassian.com/ 

    普米的wiki/confluence 迁移到了新的地址https://start.atlassian.com/ ,大家在新的系统上更新daily scrum,
    请知悉 https://prometheanworld.atlassian.net/wiki/spaces/PANM/overview

    Register an account:

    https://devportal.prometheanproduct.com/      点击      Create a myPromethean account

    How to get the idToken from devui

    1. Access https://devui.prometheanproduct.com/
    2. Input login email and password then click 'LOGIN TO MANGO'
    3. Open the Chrome Dev Tool (F12), and switch 'Console' Tab
    4. In the console, Enter 'JSON.parse(localStorage.getItem('promethean:jwt')).AuthenticationResult.IdToken' , then you can gen the idToken.

           5. Take the Authorization to this location and you can get 

       

    Two ways:

    ONE:

    query{
      Panels(searchPanelsInput:{
        offset:0,
        pageSize:2,
        searchFilter:{
          thingName:"86"
        }
      }){
        totalCount
        panels{
          name
          serialNumber
          model
          mainboardFirmware
          updateAvailable
          otaStatus
          connectivity
          status
          
        }
      }
    }

    TWO:

    以json的格式给前面的参数赋值

    QUERY

    query Panels($searchPanelsInput: ISearchPanelsInput) {
      Panels(searchPanelsInput: $searchPanelsInput) {
        panels {
          name
          serialNumber
          model
          mainboardFirmware
          updateAvailable
          tagCount
          tags
          status
          connectivityTimestamp
          __typename
        }
        totalCount
        __typename
      }
    }

    QUERY VARIABLES

    {
      "searchPanelsInput":{
         "offset":0,
         "pageSize":2,
         "searchFilter":{
           "thingName":"86"
        }
      }
    }

    Send Request from GraphQL Playground

    playground url

     
    dev
    local debug (default port is 4000, you can change it in the serverless command)
    Comment
    mdm-portal https://devapi.prometheanproduct.com/mdm-portal/graphql http://127.0.0.1:4000/graphql  
    configuration https://devapi.prometheanproduct.com/configuration/graphql http://127.0.0.1:4000/graphql  
    integration https://devapi.prometheanproduct.com/integration/graphql   This is Platform's project

    x-api-key

     
    local debug/dev
    mdm-portal bv6d45mobai6lk31l9sw6s9argxn42x0x35j7jlt
    configuration bv6d45mobai6lk31l9sw6s9argxn42x0x35j7jlt
    integration y14v59tlgyczjp3encuc07ca6pnj4msj94mj53pp

    Note: For other environment, you can login to the Panel Management, then get the x-api-key from Chrome dev tool.

    Send Request

    HTTP header 
    {
    "Authorization":"Bearer XXX",   
    "x-api-key": "bv6d45mobai6lk31l9sw6s9argxn42x0x35j7jlt",
    "x-auth-organization-id": "60b63190-0832-88c0-d843-a6cda5c4eda9"
    }

    Note: XXX is the idToken which can get from section 1

    Request Body
    query Panels($searchPanelsInput: ISearchPanelsInput) {
      Panels(searchPanelsInput: $searchPanelsInput) {
        panels {
          name
          serialNumber
          model
          mainboardFirmware
          updateAvailable
          tagCount
          tags
          status
          connectivityTimestamp
          __typename
        }
        totalCount
        __typename
      }
    }

    Note: Please set the 'schema.polling.enable' with 'false' in the Settings of playground. Otherwise, the playground will send the request all the time and the server will occur 'Out of Memory' issue.

    Refer this document 

    https://shimo.im/docs/TryYYtyj6xGhy3K8

    接口测试地址:https://devapi.prometheanproduct.com/mdm-portal/graphql

    声明 欢迎转载,但请保留文章原始出处:) 博客园:https://www.cnblogs.com/chenxiaomeng/ 如出现转载未声明 将追究法律责任~谢谢合作
  • 相关阅读:
    串学习笔记
    C深度剖析学习笔记
    记英语单词ag
    树学习笔记
    如何做好项目总结
    易学队第二次团队会议
    易学队第四次团队会议
    易学队第五次团队会议
    易学队第一次团队会议
    易学队第三次团队会议
  • 原文地址:https://www.cnblogs.com/chenxiaomeng/p/15385703.html
Copyright © 2020-2023  润新知