Chilkat Online Tools

DataFlex / Salesforce Platform APIs / File Information

Back to Collection Items

Use ChilkatAx-win32.pkg

Procedure Test
    Handle hoHttp
    Boolean iSuccess
    Variant vSbResponseBody
    Handle hoSbResponseBody
    Handle hoJResp
    Integer iRespStatusCode
    String sChecksum
    String sContentHubRepository
    String sContentModifiedDate
    Integer iContentSize
    String sContentUrl
    String sCreatedDate
    String sDescription
    String sDownloadUrl
    String sExternalDocumentUrl
    String sExternalFilePermissionInformation
    String sFileAsset
    String sFileExtension
    String sFileType
    String sFlashRenditionStatus
    String sId
    Boolean iIsFileAsset
    Boolean iIsInMyFileSync
    Boolean iIsMajorVersion
    String sMimeType
    String sModerationFlags
    String sModifiedDate
    String sColor
    String sLargeIconUrl
    String sMediumIconUrl
    String sSmallIconUrl
    String sSvgIconUrl
    String sMySubscription
    String sName
    String sOrigin
    String sAdditionalLabel
    String sCommunityNickname
    String sCompanyName
    String sDisplayName
    String sFirstName
    String sId
    Boolean iIsActive
    Boolean iIsInThisCommunity
    String sLastName
    String sMotifColor
    String sMotifLargeIconUrl
    String sMotifMediumIconUrl
    String sMotifSmallIconUrl
    String sMotifSvgIconUrl
    String sMySubscription
    String sName
    String sMessage
    String sFullEmailPhotoUrl
    String sLargePhotoUrl
    String sMediumPhotoUrl
    String sPhotoVersionId
    String sSmallPhotoUrl
    String sStandardEmailPhotoUrl
    String sV_Url
    String sReputation
    String sTitle
    String sV_Type
    String sOwnerUrl
    String sUserType
    Integer iPageCount
    String sParentFolder
    String sPdfRenditionStatus
    String sPublishStatus
    String sRenditionUrl
    String sRenditionUrl240By180
    String sRenditionUrl720By480
    String sRepositoryFileId
    String sRepositoryFileUrl
    String sSharingOption
    String sSharingPrivacy
    String sSharingRole
    String sSystemModstamp
    String sTextPreview
    String sThumb120By90RenditionStatus
    String sThumb240By180RenditionStatus
    String sThumb720By480RenditionStatus
    String sTitle
    String sCurrentPageUrl
    String sNextPageUrl
    String sV_type
    String sUrl
    String sVersionNumber
    Integer i
    Integer iCount_i
    String sTemp1

    // This example assumes the Chilkat API to have been previously unlocked.
    // See Global Unlock Sample for sample code.

    Get Create (RefClass(cComChilkatHttp)) To hoHttp
    If (Not(IsComObjectCreated(hoHttp))) Begin
        Send CreateComObject of hoHttp
    End

    // Adds the "Authorization: Bearer <access_token>" header.
    Set ComAuthToken Of hoHttp To "<access_token>"

    Get Create (RefClass(cComChilkatStringBuilder)) To hoSbResponseBody
    If (Not(IsComObjectCreated(hoSbResponseBody))) Begin
        Send CreateComObject of hoSbResponseBody
    End
    Get pvComObject of hoSbResponseBody to vSbResponseBody
    Get ComQuickGetSb Of hoHttp "https://domain.com/services/data/v{{version}}/connect/files/:FILE_ID" vSbResponseBody To iSuccess
    If (iSuccess = False) Begin
        Get ComLastErrorText Of hoHttp To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Get Create (RefClass(cComChilkatJsonObject)) To hoJResp
    If (Not(IsComObjectCreated(hoJResp))) Begin
        Send CreateComObject of hoJResp
    End
    Get pvComObject of hoSbResponseBody to vSbResponseBody
    Get ComLoadSb Of hoJResp vSbResponseBody To iSuccess
    Set ComEmitCompact Of hoJResp To False

    Showln "Response Body:"
    Get ComEmit Of hoJResp To sTemp1
    Showln sTemp1

    Get ComLastStatus Of hoHttp To iRespStatusCode
    Showln "Response Status Code = " iRespStatusCode
    If (iRespStatusCode >= 400) Begin
        Showln "Response Header:"
        Get ComLastHeader Of hoHttp To sTemp1
        Showln sTemp1
        Showln "Failed."
        Procedure_Return
    End

    // Sample JSON response:
    // (Sample code for parsing the JSON response is shown below)

    // {
    //   "checksum": "71a50dbba44c78128b221b7df7bb51f1",
    //   "contentHubRepository": null,
    //   "contentModifiedDate": "2023-11-20T16:28:22.000Z",
    //   "contentSize": 95,
    //   "contentUrl": null,
    //   "createdDate": "2023-11-20T16:28:22.000Z",
    //   "description": null,
    //   "downloadUrl": "/services/data/v58.0/connect/files/069.../content?versionNumber=1",
    //   "externalDocumentUrl": null,
    //   "externalFilePermissionInformation": null,
    //   "fileAsset": null,
    //   "fileExtension": "png",
    //   "fileType": "Png",
    //   "flashRenditionStatus": "Na",
    //   "id": "069...",
    //   "isFileAsset": false,
    //   "isInMyFileSync": false,
    //   "isMajorVersion": true,
    //   "mimeType": "image/png",
    //   "moderationFlags": null,
    //   "modifiedDate": "2023-11-20T16:28:22.000Z",
    //   "motif": {
    //     "color": "939393",
    //     "largeIconUrl": "/img/content/content64.png",
    //     "mediumIconUrl": "/img/content/content32.png",
    //     "smallIconUrl": "/img/icon/files16.png",
    //     "svgIconUrl": null
    //   },
    //   "mySubscription": null,
    //   "name": "1x1.png",
    //   "origin": "Chatter",
    //   "owner": {
    //     "additionalLabel": null,
    //     "communityNickname": "User1696423780773910041",
    //     "companyName": "Salesforce",
    //     "displayName": "Name",
    //     "firstName": "firstName",
    //     "id": "005...",
    //     "isActive": true,
    //     "isInThisCommunity": true,
    //     "lastName": "Name",
    //     "motif": {
    //       "color": "1B96FF",
    //       "largeIconUrl": "/img/icon/profile64.png",
    //       "mediumIconUrl": "/img/icon/profile32.png",
    //       "smallIconUrl": "/img/icon/profile16.png",
    //       "svgIconUrl": null
    //     },
    //     "mySubscription": null,
    //     "name": "Name",
    //     "outOfOffice": {
    //       "message": ""
    //     },
    //     "photo": {
    //       "fullEmailPhotoUrl": "https://<my_domain>/ncsphoto/1wsMlOd3tVC7boygqBO8wMT9KzA0D6tqzpbs-Uw0IogXzXAXaYKJnuWCNQmXymRq?fromEmail=1",
    //       "largePhotoUrl": "https://<my_domain>/profilephoto/729.../F",
    //       "mediumPhotoUrl": "https://<my_domain>/profilephoto/729.../M",
    //       "photoVersionId": "729...",
    //       "smallPhotoUrl": "https://<my_domain>/profilephoto/729.../T",
    //       "standardEmailPhotoUrl": "https://<my_domain>/ncsphoto/1wsMlOd3tVC7boygqBO8wMT9KzA0D6tqzpbs-Uw0Ioi-dtynkoFWsl46as__TDFU?fromEmail=1",
    //       "url": "/services/data/v58.0/connect/user-profiles/005.../photo"
    //     },
    //     "reputation": null,
    //     "title": null,
    //     "type": "User",
    //     "url": "/services/data/v58.0/chatter/users/005...",
    //     "userType": "Internal"
    //   },
    //   "pageCount": 0,
    //   "parentFolder": null,
    //   "pdfRenditionStatus": "Na",
    //   "publishStatus": "PrivateAccess",
    //   "renditionUrl": "/services/data/v58.0/connect/files/069.../rendition?type=THUMB120BY90",
    //   "renditionUrl240By180": "/services/data/v58.0/connect/files/069.../rendition?type=THUMB240BY180",
    //   "renditionUrl720By480": "/services/data/v58.0/connect/files/069.../rendition?type=THUMB720BY480",
    //   "repositoryFileId": null,
    //   "repositoryFileUrl": null,
    //   "sharingOption": "Allowed",
    //   "sharingPrivacy": "None",
    //   "sharingRole": "Owner",
    //   "systemModstamp": "2023-11-20T16:28:23.000Z",
    //   "textPreview": null,
    //   "thumb120By90RenditionStatus": "NotScheduled",
    //   "thumb240By180RenditionStatus": "NotScheduled",
    //   "thumb720By480RenditionStatus": "NotScheduled",
    //   "title": "1x1.png",
    //   "topics": {
    //     "currentPageUrl": null,
    //     "nextPageUrl": null,
    //     "topics": [
    //     ]
    //   },
    //   "type": "File",
    //   "url": "/services/data/v58.0/connect/files/069...?versionNumber=1",
    //   "versionNumber": "1"
    // }

    // Sample code for parsing the JSON response...
    // Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code

    Get ComStringOf Of hoJResp "checksum" To sChecksum
    Get ComStringOf Of hoJResp "contentHubRepository" To sContentHubRepository
    Get ComStringOf Of hoJResp "contentModifiedDate" To sContentModifiedDate
    Get ComIntOf Of hoJResp "contentSize" To iContentSize
    Get ComStringOf Of hoJResp "contentUrl" To sContentUrl
    Get ComStringOf Of hoJResp "createdDate" To sCreatedDate
    Get ComStringOf Of hoJResp "description" To sDescription
    Get ComStringOf Of hoJResp "downloadUrl" To sDownloadUrl
    Get ComStringOf Of hoJResp "externalDocumentUrl" To sExternalDocumentUrl
    Get ComStringOf Of hoJResp "externalFilePermissionInformation" To sExternalFilePermissionInformation
    Get ComStringOf Of hoJResp "fileAsset" To sFileAsset
    Get ComStringOf Of hoJResp "fileExtension" To sFileExtension
    Get ComStringOf Of hoJResp "fileType" To sFileType
    Get ComStringOf Of hoJResp "flashRenditionStatus" To sFlashRenditionStatus
    Get ComStringOf Of hoJResp "id" To sId
    Get ComBoolOf Of hoJResp "isFileAsset" To iIsFileAsset
    Get ComBoolOf Of hoJResp "isInMyFileSync" To iIsInMyFileSync
    Get ComBoolOf Of hoJResp "isMajorVersion" To iIsMajorVersion
    Get ComStringOf Of hoJResp "mimeType" To sMimeType
    Get ComStringOf Of hoJResp "moderationFlags" To sModerationFlags
    Get ComStringOf Of hoJResp "modifiedDate" To sModifiedDate
    Get ComStringOf Of hoJResp "motif.color" To sColor
    Get ComStringOf Of hoJResp "motif.largeIconUrl" To sLargeIconUrl
    Get ComStringOf Of hoJResp "motif.mediumIconUrl" To sMediumIconUrl
    Get ComStringOf Of hoJResp "motif.smallIconUrl" To sSmallIconUrl
    Get ComStringOf Of hoJResp "motif.svgIconUrl" To sSvgIconUrl
    Get ComStringOf Of hoJResp "mySubscription" To sMySubscription
    Get ComStringOf Of hoJResp "name" To sName
    Get ComStringOf Of hoJResp "origin" To sOrigin
    Get ComStringOf Of hoJResp "owner.additionalLabel" To sAdditionalLabel
    Get ComStringOf Of hoJResp "owner.communityNickname" To sCommunityNickname
    Get ComStringOf Of hoJResp "owner.companyName" To sCompanyName
    Get ComStringOf Of hoJResp "owner.displayName" To sDisplayName
    Get ComStringOf Of hoJResp "owner.firstName" To sFirstName
    Get ComStringOf Of hoJResp "owner.id" To sId
    Get ComBoolOf Of hoJResp "owner.isActive" To iIsActive
    Get ComBoolOf Of hoJResp "owner.isInThisCommunity" To iIsInThisCommunity
    Get ComStringOf Of hoJResp "owner.lastName" To sLastName
    Get ComStringOf Of hoJResp "owner.motif.color" To sMotifColor
    Get ComStringOf Of hoJResp "owner.motif.largeIconUrl" To sMotifLargeIconUrl
    Get ComStringOf Of hoJResp "owner.motif.mediumIconUrl" To sMotifMediumIconUrl
    Get ComStringOf Of hoJResp "owner.motif.smallIconUrl" To sMotifSmallIconUrl
    Get ComStringOf Of hoJResp "owner.motif.svgIconUrl" To sMotifSvgIconUrl
    Get ComStringOf Of hoJResp "owner.mySubscription" To sMySubscription
    Get ComStringOf Of hoJResp "owner.name" To sName
    Get ComStringOf Of hoJResp "owner.outOfOffice.message" To sMessage
    Get ComStringOf Of hoJResp "owner.photo.fullEmailPhotoUrl" To sFullEmailPhotoUrl
    Get ComStringOf Of hoJResp "owner.photo.largePhotoUrl" To sLargePhotoUrl
    Get ComStringOf Of hoJResp "owner.photo.mediumPhotoUrl" To sMediumPhotoUrl
    Get ComStringOf Of hoJResp "owner.photo.photoVersionId" To sPhotoVersionId
    Get ComStringOf Of hoJResp "owner.photo.smallPhotoUrl" To sSmallPhotoUrl
    Get ComStringOf Of hoJResp "owner.photo.standardEmailPhotoUrl" To sStandardEmailPhotoUrl
    Get ComStringOf Of hoJResp "owner.photo.url" To sV_Url
    Get ComStringOf Of hoJResp "owner.reputation" To sReputation
    Get ComStringOf Of hoJResp "owner.title" To sTitle
    Get ComStringOf Of hoJResp "owner.type" To sV_Type
    Get ComStringOf Of hoJResp "owner.url" To sOwnerUrl
    Get ComStringOf Of hoJResp "owner.userType" To sUserType
    Get ComIntOf Of hoJResp "pageCount" To iPageCount
    Get ComStringOf Of hoJResp "parentFolder" To sParentFolder
    Get ComStringOf Of hoJResp "pdfRenditionStatus" To sPdfRenditionStatus
    Get ComStringOf Of hoJResp "publishStatus" To sPublishStatus
    Get ComStringOf Of hoJResp "renditionUrl" To sRenditionUrl
    Get ComStringOf Of hoJResp "renditionUrl240By180" To sRenditionUrl240By180
    Get ComStringOf Of hoJResp "renditionUrl720By480" To sRenditionUrl720By480
    Get ComStringOf Of hoJResp "repositoryFileId" To sRepositoryFileId
    Get ComStringOf Of hoJResp "repositoryFileUrl" To sRepositoryFileUrl
    Get ComStringOf Of hoJResp "sharingOption" To sSharingOption
    Get ComStringOf Of hoJResp "sharingPrivacy" To sSharingPrivacy
    Get ComStringOf Of hoJResp "sharingRole" To sSharingRole
    Get ComStringOf Of hoJResp "systemModstamp" To sSystemModstamp
    Get ComStringOf Of hoJResp "textPreview" To sTextPreview
    Get ComStringOf Of hoJResp "thumb120By90RenditionStatus" To sThumb120By90RenditionStatus
    Get ComStringOf Of hoJResp "thumb240By180RenditionStatus" To sThumb240By180RenditionStatus
    Get ComStringOf Of hoJResp "thumb720By480RenditionStatus" To sThumb720By480RenditionStatus
    Get ComStringOf Of hoJResp "title" To sTitle
    Get ComStringOf Of hoJResp "topics.currentPageUrl" To sCurrentPageUrl
    Get ComStringOf Of hoJResp "topics.nextPageUrl" To sNextPageUrl
    Get ComStringOf Of hoJResp "type" To sV_type
    Get ComStringOf Of hoJResp "url" To sUrl
    Get ComStringOf Of hoJResp "versionNumber" To sVersionNumber
    Move 0 To i
    Get ComSizeOfArray Of hoJResp "topics.topics" To iCount_i
    While (i < iCount_i)
        Set ComI Of hoJResp To i
        Move (i + 1) To i
    Loop



End_Procedure

Curl Command

curl -X GET
	-H "Authorization: Bearer <access_token>"
https://domain.com/services/data/v{{version}}/connect/files/:FILE_ID

Postman Collection Item JSON

{
  "name": "File Information",
  "event": [
    {
      "listen": "prerequest",
      "script": {
        "exec": [
          ""
        ],
        "type": "text/javascript"
      }
    },
    {
      "listen": "test",
      "script": {
        "exec": [
          ""
        ],
        "type": "text/javascript"
      }
    }
  ],
  "protocolProfileBehavior": {
    "disabledSystemHeaders": {}
  },
  "request": {
    "method": "GET",
    "header": [
    ],
    "url": {
      "raw": "{{_endpoint}}/services/data/v{{version}}/connect/files/:FILE_ID",
      "host": [
        "{{_endpoint}}"
      ],
      "path": [
        "services",
        "data",
        "v{{version}}",
        "connect",
        "files",
        ":FILE_ID"
      ],
      "variable": [
        {
          "key": "FILE_ID",
          "value": ""
        }
      ]
    },
    "description": "Get information about a specified file, including references to external files. Upload a new version of an existing file, including references to external files. Rename a file, move a file to a different folder, and delete a file.\nTo upload a new version of an existing file, make a POST request. Upload the new version as a binary part in a multipart/form-data request. See Uploading Binary Files. To upload a new file to the Files home, use /connect/files/users/me.Get information about a specified file, including references to external files.\nhttps://developer.salesforce.com/docs/atlas.en-us.chatterapi.meta/chatterapi/connect_resources_files_information.htm"
  },
  "response": [
    {
      "name": "File Information",
      "originalRequest": {
        "method": "GET",
        "header": [
        ],
        "url": {
          "raw": "{{_endpoint}}/services/data/v{{version}}/connect/files/:FILE_ID",
          "host": [
            "{{_endpoint}}"
          ],
          "path": [
            "services",
            "data",
            "v{{version}}",
            "connect",
            "files",
            ":FILE_ID"
          ],
          "variable": [
            {
              "key": "FILE_ID",
              "value": "0692o00000woaKjAAI"
            }
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Date",
          "value": "Mon, 20 Nov 2023 16:33:38 GMT"
        },
        {
          "key": "Strict-Transport-Security",
          "value": "max-age=63072000; includeSubDomains"
        },
        {
          "key": "X-Content-Type-Options",
          "value": "nosniff"
        },
        {
          "key": "X-XSS-Protection",
          "value": "1; mode=block"
        },
        {
          "key": "X-Robots-Tag",
          "value": "none"
        },
        {
          "key": "Cache-Control",
          "value": "no-cache,must-revalidate,max-age=0,no-store,private"
        },
        {
          "key": "Content-Type",
          "value": "application/json;charset=UTF-8"
        },
        {
          "key": "Vary",
          "value": "Accept-Encoding"
        },
        {
          "key": "Content-Encoding",
          "value": "gzip"
        },
        {
          "key": "Transfer-Encoding",
          "value": "chunked"
        }
      ],
      "cookie": [
      ],
      "body": "{\n    \"checksum\": \"71a50dbba44c78128b221b7df7bb51f1\",\n    \"contentHubRepository\": null,\n    \"contentModifiedDate\": \"2023-11-20T16:28:22.000Z\",\n    \"contentSize\": 95,\n    \"contentUrl\": null,\n    \"createdDate\": \"2023-11-20T16:28:22.000Z\",\n    \"description\": null,\n    \"downloadUrl\": \"/services/data/v58.0/connect/files/069.../content?versionNumber=1\",\n    \"externalDocumentUrl\": null,\n    \"externalFilePermissionInformation\": null,\n    \"fileAsset\": null,\n    \"fileExtension\": \"png\",\n    \"fileType\": \"Png\",\n    \"flashRenditionStatus\": \"Na\",\n    \"id\": \"069...\",\n    \"isFileAsset\": false,\n    \"isInMyFileSync\": false,\n    \"isMajorVersion\": true,\n    \"mimeType\": \"image/png\",\n    \"moderationFlags\": null,\n    \"modifiedDate\": \"2023-11-20T16:28:22.000Z\",\n    \"motif\": {\n        \"color\": \"939393\",\n        \"largeIconUrl\": \"/img/content/content64.png\",\n        \"mediumIconUrl\": \"/img/content/content32.png\",\n        \"smallIconUrl\": \"/img/icon/files16.png\",\n        \"svgIconUrl\": null\n    },\n    \"mySubscription\": null,\n    \"name\": \"1x1.png\",\n    \"origin\": \"Chatter\",\n    \"owner\": {\n        \"additionalLabel\": null,\n        \"communityNickname\": \"User1696423780773910041\",\n        \"companyName\": \"Salesforce\",\n        \"displayName\": \"Name\",\n        \"firstName\": \"firstName\",\n        \"id\": \"005...\",\n        \"isActive\": true,\n        \"isInThisCommunity\": true,\n        \"lastName\": \"Name\",\n        \"motif\": {\n            \"color\": \"1B96FF\",\n            \"largeIconUrl\": \"/img/icon/profile64.png\",\n            \"mediumIconUrl\": \"/img/icon/profile32.png\",\n            \"smallIconUrl\": \"/img/icon/profile16.png\",\n            \"svgIconUrl\": null\n        },\n        \"mySubscription\": null,\n        \"name\": \"Name\",\n        \"outOfOffice\": {\n            \"message\": \"\"\n        },\n        \"photo\": {\n            \"fullEmailPhotoUrl\": \"https://<my_domain>/ncsphoto/1wsMlOd3tVC7boygqBO8wMT9KzA0D6tqzpbs-Uw0IogXzXAXaYKJnuWCNQmXymRq?fromEmail=1\",\n            \"largePhotoUrl\": \"https://<my_domain>/profilephoto/729.../F\",\n            \"mediumPhotoUrl\": \"https://<my_domain>/profilephoto/729.../M\",\n            \"photoVersionId\": \"729...\",\n            \"smallPhotoUrl\": \"https://<my_domain>/profilephoto/729.../T\",\n            \"standardEmailPhotoUrl\": \"https://<my_domain>/ncsphoto/1wsMlOd3tVC7boygqBO8wMT9KzA0D6tqzpbs-Uw0Ioi-dtynkoFWsl46as__TDFU?fromEmail=1\",\n            \"url\": \"/services/data/v58.0/connect/user-profiles/005.../photo\"\n        },\n        \"reputation\": null,\n        \"title\": null,\n        \"type\": \"User\",\n        \"url\": \"/services/data/v58.0/chatter/users/005...\",\n        \"userType\": \"Internal\"\n    },\n    \"pageCount\": 0,\n    \"parentFolder\": null,\n    \"pdfRenditionStatus\": \"Na\",\n    \"publishStatus\": \"PrivateAccess\",\n    \"renditionUrl\": \"/services/data/v58.0/connect/files/069.../rendition?type=THUMB120BY90\",\n    \"renditionUrl240By180\": \"/services/data/v58.0/connect/files/069.../rendition?type=THUMB240BY180\",\n    \"renditionUrl720By480\": \"/services/data/v58.0/connect/files/069.../rendition?type=THUMB720BY480\",\n    \"repositoryFileId\": null,\n    \"repositoryFileUrl\": null,\n    \"sharingOption\": \"Allowed\",\n    \"sharingPrivacy\": \"None\",\n    \"sharingRole\": \"Owner\",\n    \"systemModstamp\": \"2023-11-20T16:28:23.000Z\",\n    \"textPreview\": null,\n    \"thumb120By90RenditionStatus\": \"NotScheduled\",\n    \"thumb240By180RenditionStatus\": \"NotScheduled\",\n    \"thumb720By480RenditionStatus\": \"NotScheduled\",\n    \"title\": \"1x1.png\",\n    \"topics\": {\n        \"currentPageUrl\": null,\n        \"nextPageUrl\": null,\n        \"topics\": []\n    },\n    \"type\": \"File\",\n    \"url\": \"/services/data/v58.0/connect/files/069...?versionNumber=1\",\n    \"versionNumber\": \"1\"\n}"
    }
  ]
}