---
# System prepended metadata

title: Asset File GQL

---

# Asset File GQL

[TOC]

## Jeff

1.**CreateRole(1857)**   
```GQL
mutation ($role: CreateRole) {
  createRole(role: $role) {
    id
    name
    __typename
  }
}
```
2.**deleteRole(1857)**	
```GQL
mutation ($id: ID!) {
  deleteRole(id: $id) {
    id
    __typename
  }
}
```
3.**deleteAssetContent(1876)**
```GQL
mutation deleteContentAssociations($input: DeleteContentAssociationsInput!) {
  deleteContentAssociations(input: $input) {
    id
    __typename
  }
}
```
4.**download asset file(1877)**
```GQL
query Content($id: ID!) {
  content(id: $id) {
    url
    __typename
  }
}
```

5.**change features toggle**
```GQL
fragment FeaturesFragment on Features {
  assetContent
  deviceConfig
  deviceControl
  iotConversion
  location
  urlType
  assetTimeout
  __typename
}

mutation maskFeatures($features: FeatureInput) {
  maskFeatures(features: $features) {
    ...FeaturesFragment
    __typename
  }
}
```
Variables
```json=
{
	"features": {
		"assetContent": true,
		"deviceConfig": true,
		"deviceControl": true,
		"iotConversion": true,
		"location": null,
		"urlType": true,
		"assetTimeout": false
	}
}
```

## Willie 
1.**Upload File(1863)**
``` GQL
mutation updateContentAssociations($input: UpdateContentAssociationsInput!) {
  updateContentAssociations(input: $input) {
    id
    associations {
      type
      id
      __typename
    }
    __typename
  }
}
```

2.**Share Asset File(1867)**
```GQL
mutation updateContentAssociations($input:UpdateContentAssociationsInput!) {
  updateContentAssociations(input: $input) {
    id
    associations {
      type
      id
      __typename
    }
    __typename
  }
}
```

3. **Remove File(1869)**
```GQL
mutation deleteContentAssociations($input:DeleteContentAssociationsInput!) {
  deleteContentAssociations(input: $input) {
    id
    __typename
  }
}
```


4. **Sort & Filter(1865)**
```GQL
query assetContents($filters: ContentFilters, $pagination: Pagination, $product_id: ID, $device_ids: [ID!]) {
  assetContents(filters: $filters, pagination: $pagination, product_id: $product_id, device_ids: $device_ids) {
    assetContents {
      id
      name
      associations {
        type
        id
        __typename
      }
      tags {
        name
        value
        __typename
      }
      contentType
      createdBy {
        __typename
        ... on Device {
          identity
          __typename
        }
        ... on User {
          name
          __typename
        }
      }
      type
      lastModified
      length
      __typename
    }
    totalCount
    __typename
  }
}
```
5. **Download Asset File(1871)**
```GQL
query Content($id: ID!) {
  content(id: $id) {
    url
    __typename
  }
}
```

6. **Filter by name(1874)**
```GQL
query assetContents($filters: ContentFilters, $pagination: Pagination, $product_id: ID, $device_ids: [ID!]) {
  assetContents(filters: $filters, pagination: $pagination, product_id: $product_id, device_ids: $device_ids) {
    assetContents {
      id
      name
      associations {
        type
        id
        __typename
      }
      tags {
        name
        value
        __typename
      }
      contentType
      createdBy {
        __typename
        ... on Device {
          identity
          __typename
        }
        ... on User {
          name
          __typename
        }
      }
      type
      lastModified
      length
      __typename
    }
    totalCount
    __typename
  }
}
```
Variables
```json=
{  
   filters:{  
      contentTypes:[  

      ],
      orderBy:"updated_at",
      sort:"asc",
      name:"test"
   }
}
```


# **Epic Verify Ticket**

## UI
|                 |    Checked      |       Note       |      Tester      |     Comment      |    Create Ticket    |  Regression Sheet   | 
|:---------------:|:---------------:|:----------------:|:----------------:|:----------------:|:-------------------:|:-------------------:|
| EXOSENSE-1833   |      O    O     |Ready for Release |     Willie       |      Done        |        N/A          |        N/A          |
| EXOSENSE-1857   |           O     |Ready for Release |      Jeff        |      Done        |    EXOSENSE-2448    |        Done1        |
| EXOSENSE-1858   |      O          |Ready for Release |     Willie       |      Done        |    ROBOT_NONEED     |        Done1        |
| EXOSENSE-1862   |      O    O     |Ready for Release |     Willie       |      Done        |    EXOSENSE-2437    |        Done1        |
| EXOSENSE-1863   |      O    O     |Ready for Release |     Willie       |      Done        |    ROBOT_NONEED     |        Done1        |
| EXOSENSE-1865   |      O          |Ready for Release |     Willie       |      Done        |      2441, 2566     |        Done1        |
| EXOSENSE-1867   |      O          |Ready for Release |      Jeff        |      Done        |    EXOSENSE-2442    |        Done1        |
| EXOSENSE-1869   |      O    O     |Ready for Release |     Willie       |      Done        |    EXOSENSE-2440    |        Done1        |
| EXOSENSE-1871   |      O          |Ready for Release |     Willie       |      Done        |    ROBOT_NONEED     |        Done1        |
| EXOSENSE-1874   |      O          |Ready for Release |     Willie       |      Done        |   2449, 2450, 2453  |        Done1        |
| EXOSENSE-1876   |                 |   Move to 2469   |       X          |       X          |         X           |          X          |
| EXOSENSE-1877   |                 |     Closed       |       X          |       X          |         X           |          X          |
| EXOSENSE-1880   |                 |     Closed       |       X          |       X          |         X           |          X          |
| EXOSENSE-1997   |      O          |Ready for Release |     Willie       |      Done        |    ROBOT_NONEED     |          X          |
| EXOSENSE-2375   |           O     |Ready for Release |      Jeff        |      Done        |    EXOSENSE-2485    |        Done1        |
  
## GQL 
|                 |    Checked      |       Note       |      Tester      |     Comment      |    Create Ticket    |
|:---------------:|:---------------:|:----------------:|:----------------:|:----------------:|:-------------------:|
| EXOSENSE-1835   |       O         |Ready for Release |      Willie      |      Done        |     ROBOT_NONEED    |
| EXOSENSE-1859   |                 |       DB         |      Comet       |                  |                     |
| EXOSENSE-1861   |                 |       DB         |      Comet       |                  |                     |
| EXOSENSE-1864   |       O         |Ready for Release |      Willie      |      Done        |      2554, 2564     |
| EXOSENSE-1866   |       O         |Ready for Release |      Willie      |      Done        |     EXOSENSE-2468   |
| EXOSENSE-1872	  |       O         |Ready for Release |      Willie      |      Done        |      2467, 2570     |
| EXOSENSE-1873   |                 |     Closed       |                  |                  |                     |
| EXOSENSE-1875   |                 |     Closed       |                  |                  |                     |
| EXOSENSE-1877   |                 |     Closed       |                  |                  |                     |
| EXOSENSE-1879   |                 |     Closed       |                  |                  |                     |
| EXOSENSE-1995   |                 |Ready for Release |       Ron        |                  |                     |
| EXOSENSE-2052   |                 |     repeat       |       Ron        |                  |                     |
| EXOSENSE-2053   |                 |     repeat       |      Comet       |                  |                     |
| EXOSENSE-2067   |       O         |Ready for Release |      Willie      |      Done        |     EXOSENSE-2256   |
| EXOSENSE-2193   |                 |Ready for Release |      Comet       |                  |                     |
| EXOSENSE-2233   |                 |     Closed       |                  |                  |                     |
| EXOSENSE-2455   |       O         |Ready for Release |      Willie      |      Done        |     2584            |
| EXOSENSE-2465   |       O         |Ready for Release |      Willie      |                  |  2603, 2604, 2605   |
| EXOSENSE-2469   |       O         |Ready for Release |      Willie      |                  |                     |
  
  
## Comment Template (2019/8/20 update)
```xml=
Test Date: 2019/08/DD
Test Build: exosense-ui #tag 2.24.0-qa7, exosense-pipeline #tag 2.24.0-qa1, exosense-gql #tag 2.24.0-qa4
Test Browser: Chrome[74.0.3729.157], Edge[44.17763.1.0], IE[11.615.17763.0]
Test Env: https://rcm2-qa.apps.exosite.io

Test Steps:
Test Result:

CC                  
```

## Daily Verify Reply Template
```typescript=
QA sprint
pass:  N/A
fail:  N/A
bug:   N/A
Today: N/A
Now:   N/A
```
 
# Data Type
:::info
Image
Text
CSV Data
URL
Video-Only Youtube
PDF 
:mega: **URL & Video** Cannot upload file, just input url in the text field.
:::

# Filter & Search ＆ Sort
:::success
**File Type**
**File Source(User | Device)**

**Sort by File_Name, Upload_time**
:::

# 3 Dots
:::warning
Download | Go To
> Url type: should use user input url in link tag. If link tag is not exist then use the content as url. 
>Non-url type: generate download url 

Share
> Share file to another asset.
Remove
:::

# Asset Templates
:::info
 Create asset from template, will not contain asset file.
:::

# Story

1. **廠商或系統供應商希望上傳原理圖or用戶指南...等等,以方便用戶可以更快速的查看此資產的相關訊息。使得Exosense不只是觀看Device upload的Data, 而是能讓用戶一次觀看到更完整的資訊。**

2. **用戶也可以上傳自己所需要的文件或者圖片...等等。**
3. **用戶如果上傳有關資產的用戶指南,可以apply到其他使用相同機器的asset,而不必每個asset都個別上傳file**
4. **Device可以上傳Log, 讓user可以隨時查看Device的運行情況。**

---
:::info
# Not Completed
1. exosense-2389 +api
2. icon bug(2019-07-31 下午4.14.26 have picture)
3. EXOSENSE-2475  should create ticket 

|   Jeff Not Completed     |            State           |
|:------------------------:|:--------------------------:|
|      EXOSENSE-2389       |      Create 2486, 2487     |
|      EXOSENSE-2428       |      Create 2497, 2510     |
|      EXOSENSE-2430       |      Create 2511, 2512     |
|      EXOSENSE-2269       |      Ready for Release     |
|      EXOSNESE-1869       |      Ready for Release     |
|      EXOSENSE-1833       |      Ready for Release     |
|        icon bug          |        EXOSENSE-2517       |
|      EXOSENSE-2375       |         Create 2485        |


# Create QA-task Ticket(Very important)

> <font size="4" color="red">WEB assign to Comet </font>
> <font size="4" color="red">API assign to  Ron </font>



# [Device Content Upload](https://docs.google.com/document/d/1jTrS69WtrwwkypEYeYKVZ_EcEv7IW4eLrOrXfA6OyDY/edit#)
**1. <span style="color:blue">Provision Device</span>**

Prep: https://www.exosite.io/business/940f2l7hnhw/solutions

```json=
curl -X POST 'https://<product-endpoint>/provision/activate' \
 -H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \
 -d 'id=<identity>'
```

Note: 
<product-endpoint>: Copy Solution ID 
![](https://i.imgur.com/HZPqFsw.png)

<identity>: Device Name(anyname you want)
++Call the above api and it will return CIK of the device(**In the response**)++

![](https://i.imgur.com/hJeB9fk.png)

> Another method to get Device CIK
  


**2. <span style="color:blue">Upload Device Content</span>** 

Link: https://docs.google.com/document/d/1HGrayI5Jq0tOZEnHzOhxdeg3sA-MvlkwxdvLqSQC0bc/edit

```json=
curl --request PUT \
  --url 'https://<solutionID>.m2.exosite.io/onep:v1/content/<contentID>/' \
  --header 'content-type: application/octet-stream' \
  --header 'x-exosite-cik: <deviceCIK>' \
  --data-binary @file
```
***

```json=
curl --request PUT \
  --url 'https://t1g3w5s2nli2o0000.m2.exosite.io/onep:v1/content/<contentID>/' \
  --header 'content-type: application/octet-stream' \
  --header 'x-exosite-cik: uN2dzKzAm2ZcmzJm4UsRDEOa9aRkNZAKAz4nblA8' \
  --data-binary @file
```

**3. <span style="color:blue">Download Device Content</span>** 

Link: https://docs.google.com/document/d/1HGrayI5Jq0tOZEnHzOhxdeg3sA-MvlkwxdvLqSQC0bc/edit#

```json=
curl --request GET \
  --url 'https://<solutionID>.m2.exosite.io/provision/download?id=device2/willieepic/<contentID>' \
  --header 'content-type: application/json' \
  --header 'x-exosite-cik: <deviceCIK>'
```
***

```json=
curl --request GET \
  --url 'https://t1g3w5s2nli2o0000.m2.exosite.io/provision/download?id=device2%2Fwilliedemo%2Fwilliedemo_img' \
  --header 'content-type: application/json' \
  --header 'x-exosite-cik: 623aa6a21747986dc5abc734492e4b25c56f929a'
```

**4. <span style="color:blue">List Device Content</span>**

```json=
curl --request GET \
  --url 'https://<solutionID>.m2.exosite.io/provision/download' \
  --header 'content-type: application/csv' \
  --header 'x-exosite-cik: <deviceCIK>'
```
***

```json=
curl --request GET \
  --url 'https://t1g3w5s2nli2o0000.m2.exosite.io/provision/download' \
  --header 'content-type: application/csv' \
  --header 'x-exosite-cik: uN2dzKzAm2ZcmzJm4UsRDEOa9aRkNZAKAz4nblA8' 
```

```json=
curl --request POST \
  --url https://rcm-graphql-twqa.hosted.exosite.io/graphql \
  --header 'authorization: Automation eyJpZCI6ImF1dG9tb24tdG9rZW58MTU2NDY0Mzk0MTkyNjAuNjI5MzY0MDMwNzQ5MjkiLCJ0b2tlbiI6ImRJUkNVOUlsamhrL0ZtNXl0NVFNdFNXSUZEQzAzWmRHczh4QnpUWlJjTWY2bnkzY0NkbFNEUFVNcUtDT0FQdzdhZ1NUdkNQeWNuY0t2c3JzSlVjQXpWV0lFdWxXaVdZVjBpQlJtc0RSaHdtNHhQV3p6Qlh2Lzg1bWcvSXVmaWJuYWJpNGwyT1NVRDJROXdvM3p0KzcrR0x5ckVZdTk4MEs5dDVCQ2ZLVy9vTmtrOTJkbjVEaXNOU2owQ0toV0tYSklyaXF2Tlcwclp5WkxDdk9oMXZXenIvVlBiSDhBMSt5bmtMS2kzYWR4RHdMeEEzZnM3b2FOSTJsd0ZqQVVvL2ZTSzJ6THlkQ1JaRmVqWVpHMHhLVTVseW0zdmd3emlzZkZVRlptc2VlUStqd2pHdEZZS3JpSURlWkVKOUNYQXZxUE5ybUczdHdlWDIrbjk4blRqNmpCYjA9In0=' \
  --header 'content-type: application/json' \
  --header 'origin: https://rcm2-qa.apps.exosite.io' \
  --cookie OPENSHIFT_EDGE_rcm-graphql-dev_rcm-graphql-twqa_SERVERID=7c71d005819b691bbfe5ee1d2cfbc6bf \
  --data '{"query":"query contents($product_id: ID, $filters: ContentFilters, $pagination: Pagination) {\n  contents(product_id: $product_id, filters: $filters, pagination: $pagination) {\n    id\n    url\n    name\n  }\n}","variables":{"product_id":"t1g3w5s2nli2o0000"},"operationName":"contents"}'
```


### <span style="color:Green">On Murano Production use Keystore to list device content</span>

> (1) Go to [Murano Production](https://www.exosite.io/business/940f2l7hnhw/solutions) then click ypur own product(IOT Connectors)
  ![](https://i.imgur.com/YiKvSU7.png)

> (2) Create an Endpoints to list **Device Content**
  ![](https://i.imgur.com/nNXhcyB.png)

> (3) Go To Documentation
  ![](https://i.imgur.com/OxQ7pmJ.png)

> (4) Run Endpoints
  ![](https://i.imgur.com/yq27bLp.png)
  Result:
  ![](https://i.imgur.com/goKGcb9.png)


# Content Service
> Docs: http://docs.exosite.com/reference/services/content/

# **<span style="color:red">Check Jenkins Report</span>**
  ![](https://i.imgur.com/aexBlMf.png)
  ![](https://i.imgur.com/cxpXKoF.png)
  ![](https://i.imgur.com/5bCQK46.png)
  ![](https://i.imgur.com/HzUH210.png)
  ![](https://i.imgur.com/p7wXukl.png)

  
> <font size="4" color="black">Then check the log file</font>
> <font size="4" color="black">如果錯誤不是Jenkins本身的問題(EX: 速度太快), 若是Robot code的問題請開 QA-task Ticket</font>


# Problem with Content_upload(Solved)
  ![](https://i.imgur.com/QDHOYce.png)
> Solution:
  把這行 print(event) 清掉就好了
  ![](https://i.imgur.com/960jVbl.png)



# Exosense Api import file into insomnia
> > File Link: https://drive.google.com/file/d/1VN6L_4wFcplyrVDFjmXwyG98s_ZPHeya/view?usp=sharing
> > __But need to classify by yourself.__
> > [name=Willie Chen] [time=Thu, Agu 12, 2019] [color=#907bf7]


## ==Exosense Web的Jenkins由Willie&Jeff負責==
><span style="color:black">Note: Jenkins附的Command都跑在dqa-murano資料夾, 但我們在local端跑要改成dqa-exosense, 因為我們包的跟他們包的不一樣</span>
::: 
