Examples

PATCH /api/v2/insight-documents/1
{
  "data": {
    "id": "1",
    "type": "insight-documents",
    "attributes": {
      "source-file-name": "source_test.pdf",
      "source-file-size": "1024",
      "source-updated-at": "2017-08-29 10:52:21 +0800",
      "source-content-type": "application/pdf",
      "title": "new insight doc title"
    },
    "relationships": {
      "insight": {
        "data": {
          "type": "insights",
          "id": "192"
        }
      }
    }
  }
}
200
{
  "data": {
    "id": "1",
    "type": "insight-documents",
    "links": {
      "self": "http://test.host/api/v2/insight-documents/1"
    },
    "attributes": {
      "source": "https://static-dev.smartkarma.com/insight_documents/sources/000/000/001/original/source_test.pdf?1503975141",
      "source-file-name": "source_test.pdf",
      "source-file-size": 1024,
      "source-updated-at": "2017-08-29T10:52:21.233+08:00",
      "source-content-type": "application/pdf",
      "title": "new insight doc title"
    },
    "relationships": {
      "insight": {
        "links": {
          "self": "http://test.host/api/v2/insight-documents/1/relationships/insight",
          "related": "http://test.host/api/v2/insight-documents/1/insight"
        }
      }
    }
  }
}

Params

Param name Description
data
required

Insight Document information

Validations:

  • Must be a Hash

data[type]
optional

Validations:

data[attributes]
optional

Validations:

  • Must be a Hash

data[attributes][title]
optional , nil allowed

Title of the file

Validations:

  • Must be a String

data[attributes][source]
optional

the file in data URL format

Validations:

  • Must be a String

data[attributes][source-file-name]
optional

Validations:

  • Must be a String

data[attributes][source-file-size]
optional , nil allowed

Validations:

  • Must be a String

data[relationships]
optional

Validations:

  • Must be a Hash

data[relationships][insight]
optional

Validations:

  • Must be a Hash

data[relationships][insight][data]
optional

Validations:

  • Must be a Hash

data[relationships][insight][data][type]
optional

Insight type, which is `insights`

Validations:

  • Must be a String

data[relationships][insight][data][id]
optional

Insight ID

Validations:

  • Must be an identifier, string from 1 to 128 characters containing only alphanumeric characters, space, underscore(_), hyphen(-) with no leading or trailing space.