モデルAPI CODE SNIPPETS

モデルAPI CODE SNIPPETS

最終更新日:2021年1月14日 13:55


あなたのモデルをサーチする



Sample Request
query {
models(query: "*") {
    totalResults
     results {
        id
         name
      description
    }
  }
}


Sample Response

{
  "data": {
    "models": {
      "totalResults": 1,
      "results": [
        {
          "id": "L67HxJ6KfuJ",
          "name": "352 E Java Dr",
          "description": ""
        }
      ]
    }
  }
}

matterpakを買う


Sample Request
mutation buyMatterpak {
  unlockModelBundle(
    id: "zTzPWitcMWd",
    bundleId: "mp:matterpak"
  ) {
  id
    name
    description
    availability
    assets { url }
  }
}


Sample Response

Use the URL from the response to download the Matterpak

{
  "data": {
   "unlockModelBundle": {
      "id": "mp:matterpak",
      "name": "Matterpak",
      "description": "Order high resolution assets associated with the model.",
      "availability": "unlocked",
      "assets": [
         {
"url": "
https://qa-cdn-1.matterport.com/models/group_77/job_62927cc2-7552-4aad-8330-3904c5198354/wf_39d3f0f8baae4fc9aaeb6326edf55d8f/mesh/1.1.466.14860/2016-11-09_0240.05/62927cc275524aad83303904c5198354.zip?t=2-b3da2c89760c80f1671bc260d678d949f29bd8a8-1573485841-1"
         }
      ]
    }
  }
}

全てのスウィープロケーションとパノラマを取得する


Sample Request
{
    model(id:"cnEKjinzKvH") {
    locations {
      id
      model {id}
      position {x, y, z}
      floor {id}
      room {id}
      panos {
        id
        skybox {
          id
          status
          format
          children
        }
      }
    }
  }
}


Sample Response

{
  "data": {
    "model": {
      "locations": [
        {
          "id": "a0723324-ab3e-4500-bdee-8fec13d3ae9d",
          "model": {
            "id": "cnEKjinzKvH"
          },
          "position": {
            "x": 0,
            "y": 0,
            "z": 0
          },
          "panos": [
            {
              "id": "a0723324-ab3e-4500-bdee-8fec13d3ae9d",
              "skybox": {
                "id": "a0723324-ab3e-4500-bdee-8fec13d3ae9d",
                "status": "available",
                "format": "skybox",
;               "children": [
                  "
https://qa-cdn-1.matterport.com/models/1a56eedeff7d4a7481b961c009ae9236/assets/pan/~/high/a0723324ab3e4500bdee8fec13d3ae9d_skybox0.jpg?t=2-c81c9af53e390d7c5d9946f73a74665f0e06757c-1573701898-1",
                  "
https://qa-cdn-1.matterport.com/models/1a56eedeff7d4a7481b961c009ae9236/assets/pan/~/high/a0723324ab3e4500bdee8fec13d3ae9d_skybox1.jpg?t=2-c81c9af53e390d7c5d9946f73a74665f0e06757c-1573701898-1",
                  "
https://qa-cdn-1.matterport.com/models/1a56eedeff7d4a7481b961c009ae9236/assets/pan/~/high/a0723324ab3e4500bdee8fec13d3ae9d_skybox2.jpg?t=2-c81c9af53e390d7c5d9946f73a74665f0e06757c-1573701898-1",
                  "
https://qa-cdn-1.matterport.com/models/1a56eedeff7d4a7481b961c009ae9236/assets/pan/~/high/a0723324ab3e4500bdee8fec13d3ae9d_skybox3.jpg?t=2-c81c9af53e390d7c5d9946f73a74665f0e06757c-1573701898-1",
                  "
https://qa-cdn-1.matterport.com/models/1a56eedeff7d4a7481b961c009ae9236/assets/pan/~/high/a0723324ab3e4500bdee8fec13d3ae9d_skybox4.jpg?t=2-c81c9af53e390d7c5d9946f73a74665f0e06757c-1573701898-1",
                  "
https://qa-cdn-1.matterport.com/models/1a56eedeff7d4a7481b961c009ae9236/assets/pan/~/high/a0723324ab3e4500bdee8fec13d3ae9d_skybox5.jpg?t=2-c81c9af53e390d7c5d9946f73a74665f0e06757c-1573701898-1"
                ]
              }
            }
          ]
        },
        {

全てのMattertagsとLocationsを取得する


Sample Request
{
    model(id:"cnEKjinzKvH") {
        mattertags {
          id
               label
          description
          media
          position {x, y, z}
      }
  }
}

Sample Response

{
  "data": {
    "model": {
      "mattertags": [
        {
          "id": "ayi201wkujs",
          "label": "Nest Thermostat",
          "description": "",
          "media": "
https://www.youtube.com/watch?v=vgowFxYI8PI",
          "position": {
            "x": -1.20415628,
            "y": -5.35434341,
            "z": 3.1942153
          }
        },
        {…

Cubicasaにスキーマティックフロアプランをオーダーする


To purchase
mutation buyFloorplan {
  unlockModelBundle(
    id: "zTzPWitcMWd",
    bundleId: "cubicasa:floorplan",
    options: {deliverySpeed: normal}
    )
    {
    id
    name
    description
    availability
    assets { url }
  }
}

Again, floor plan assets won't be available until Cubicasa returns it (normal speed is about 2 days). 

アセットバンドルの中からアセットを見つける



{
  model(id:"X5bUTgEDCe3") {
    bundles {
      id
      availability
      name
      description
     assets {
        id
        url
        validUntil
        format
        filename
        status
      }
      supportedOptions {
        deliverySpeeds
      }
    }
  }
}

アセットを検索する




query getFloorplan($modelId:ID!) {
  model(id: $modelId) {
    bundle(id: "cubicasa:floorplan") {
      assets { url }
    }
  }
}

貴方のモデルに関するデリバリースピードを知る



query getSupportedFloorplanDeliverySpeeds($modelId: ID!) {
   model(id: $modelId) {
      bundle(id: 'cubicasa:floorplan') {
         supportedOptions { deliverySpeeds }
      }
   }
}


バンドルに関する異なるオプションを知る



query getSupportedOptions($modelId: ID!) {
   model(id: $modelId) {
      bundles {
         supportedOptions { units deliverySpeeds }
      }
   }
}


色づけされたフロアプランを取得する


 
{
 model(id: $modelId) {
    assets {
      floorplans(provider: "matterport", flags: [colored_rooms]) {
        provider
        format
        flags
        id
        url

    }
  }
}