Reading Contact Images

The following endpoints can be used to read contact images

  • Profile Picture: /api/images/contact/<contactId>/profilepicture
  • Business Card Front: /api/images/contact/<contactId>/cardfront
  • Business Card Back: /api/images/contact/<contactId>/cardback
The HTTP Accept Header is used to get the image in different formats. The supported formats are:
  • application/json Image data as a JSON object with the image binary base64 encoded
  • image/jpeg Get a jpeg image
  • image/png Get a png image
  • image/gif Get a gif image
  • image/tiff Get a tiff image

Example Request Accepting a JSON object

    curl -X GET -H Content-Type:application/json \
    -H x-compass-token:b3d83cd6-9cd2-4f2a-a3e5-911e94025ecd \
    -H Accept:application/json \
    https://compass.cosential.com/api/images/contact/54321/profilepicture

Example Response

{
  "ContentType": "image/jpeg",
  "Data": "/9j/4AAQSkZJRgABAgEAAAAAAAD/="
}

Example Request Accepting a jpeg image

    curl -X GET -H Content-Type:application/json \
    -H x-compass-token:b3d83cd6-9cd2-4f2a-a3e5-911e94025ecd \
    -H Accept:image/jpeg \
    https://compass.cosential.com/api/images/contact/54321/profilepicture

Example Response

[binary data]

Updating Contact Images

An HTTP PUT request to the following endpoints can be used to update contact images

  • Profile Picture: /api/images/contact/<contactId>/profilepicture
  • Business Card Front: /api/images/contact/<contactId>/cardfront
  • Business Card Back: /api/images/contact/<contactId>/cardback
There are multiple ways to update a contact Image.
  • Specify the url parameter in the query string to update the image from a public URL
  • Send the image data using Multipart form data
  • Speicify the Content-Type header of application/json to send the image as a base64 encoded string in a JSON object

Example Request using a URL parameter

    curl -X PUT \
    -H x-compass-token:b3d83cd6-9cd2-4f2a-a3e5-911e94025ecd \ 
    -H "Content-Type: application/x-www-form-urlencoded" -d '' \
    https://compass.cosential.com/api/images/contact/54321/cardback?url=https%3a%2f%2fcompass.cosential.com%2fcontent%2fimages%2flogo.png

Example Response

[200 OK]

Example Request sending a file using multipart form data

    curl -X PUT \
    -H x-compass-token:b3d83cd6-9cd2-4f2a-a3e5-911e94025ecd \
    -H "Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW" 
    -F "data=[object Object]" \
    https://compass.cosential.com/api/images/contact/54321/cardback

Example Response

[200 OK]

Example Request sending a JSON object with base64 encoded data

    curl -X PUT \
    -H x-compass-token:b3d83cd6-9cd2-4f2a-a3e5-911e94025ecd \
    -H "Content-Type: application/json" \
    -d '{
        "ContentType": "image/jpeg",
        "Data": "/9j/4AAQSkZJRgABAQEAAAAAAAD/9k="
    }' \
    https://compass.cosential.com/api/images/contact/54321/cardback

Example Response

[200 OK]

Delete Contact Images

An HTTP DELETE request to the following endpoints can be used to delete contact images

  • Profile Picture: /api/images/contact/<contactId>/profilepicture
  • Business Card Front: /api/images/contact/<contactId>/cardfront
  • Business Card Back: /api/images/contact/<contactId>/cardback

Example Request

    curl -X DELETE \
    -H x-compass-token:b3d83cd6-9cd2-4f2a-a3e5-911e94025ecd \ 
    https://compass.cosential.com/api/images/contact/54321/cardback

Example Response

[200 OK]

Reading Company Images

The following endpoint can be used to read the company logo image.

  • Company Logo: /api/images/companies/<companyId>/
  • Company Logo Thumbnail: /api/images/companies/<companyId>/thumb
The HTTP Accept Header is used to get the image in different formats. The supported formats are:
  • application/json Image data as a JSON object with the image binary base64 encoded
  • image/jpeg Get a jpeg image
  • image/png Get a png image
  • image/gif Get a gif image
  • image/tiff Get a tiff image

Example Request Accepting a JSON object

    curl -X GET -H Content-Type:application/json \
    -H x-compass-token:b3d83cd6-9cd2-4f2a-a3e5-911e94025ecd \
    -H Accept:application/json \
    https://compass.cosential.com/api/images/companies/54321

Example Response

{
  "ContentType": "image/jpeg",
  "Data": "/9j/4AAQSkZJRgABAgEAAAAAAAD/="
}

Example Request Accepting a jpeg image

    curl -X GET -H Content-Type:application/json \
    -H x-compass-token:b3d83cd6-9cd2-4f2a-a3e5-911e94025ecd \
    -H Accept:image/jpeg \
    https://compass.cosential.com/api/images/companies/54321

Example Response

[binary data]

Updating Company Images

An HTTP PUT request to the following endpoints can be used to update company images

  • Company Logo: /api/images/companies/<companyId>
There are multiple ways to update a company Image.
  • Specify the url parameter in the query string to update the image from a public URL
  • Send the image data using Multipart form data
  • Speicify the Content-Type header of application/json to send the image as a base64 encoded string in a JSON object

Example Request using a URL parameter

    curl -X PUT \
    -H x-compass-token:b3d83cd6-9cd2-4f2a-a3e5-911e94025ecd \ 
    -H "Content-Type: application/x-www-form-urlencoded" -d '' \
    https://compass.cosential.com/api/images/companies/54321?url=https%3a%2f%2fcompass.cosential.com%2fcontent%2fimages%2flogo.png

Example Response

[200 OK]

Example Request sending a file using multipart form data

    curl -X PUT \
    -H x-compass-token:b3d83cd6-9cd2-4f2a-a3e5-911e94025ecd \
    -H "Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW" 
    -F "data=[object Object]" \
    https://compass.cosential.com/api/images/companies/54321

Example Response

[200 OK]

Example Request sending a JSON object with base64 encoded data

    curl -X PUT \
    -H x-compass-token:b3d83cd6-9cd2-4f2a-a3e5-911e94025ecd \
    -H "Content-Type: application/json" \
    -d '{
        "ContentType": "image/jpeg",
        "Data": "/9j/4AAQSkZJRgABAQEAAAAAAAD/9k="
    }' \
    https://compass.cosential.com/api/images/companies/54321

Example Response

[200 OK]

Delete Company Images

An HTTP DELETE request to the following endpoints can be used to delete company images

  • Company Logo: /api/images/companies/<companyId>

Example Request

    curl -X DELETE \
    -H x-compass-token:b3d83cd6-9cd2-4f2a-a3e5-911e94025ecd \ 
    https://compass.cosential.com/api/images/companies/54321

Example Response

[200 OK]

Creating Project Images

Project images are created with two or more API calls. The first call is to create one or more project image metadata objects using the endpoint /api/projects/<projectId>/images. Once the metadata is created, you can use the endpoint /api/images/project/<projectId>/<imageId> to upload the image binary data.

Example Request creating 2 Image Metadata Objects

    curl -X POST -H Content-Type:application/json \
    -H x-compass-token:b3d83cd6-9cd2-4f2a-a3e5-911e94025ecd \
    -d '[{
            "ImageName": "file1.jpg",
            "Caption": "Big Building Site",
            "Keywords": "building,construction,blue,sky",
            "IsWebsiteImage": true,
            "IsWebsiteThumbnail": false,
            "NetworkPath": "\\\\files.mycompany.com\\files\\file1.jpg",
            "Comments": "This building is scheduled to be built soon"
        },{
            "ImageName": "file2.jpg"
    }]' https://compass.cosential.com/api/projects/54321/images

Response

[
  {
    "ProjectId": 54321,
    "ProjectName": "Blue Skies Big Building",
    "ProjectNumber": "",
    "ImageId": 76543,
    "ImageName": "file1.jpg",
    "Caption": "Big Building Site",
    "Credit": null,
    "Keywords": "building,construction,blue,sky",
    "IsWebsiteImage": true,
    "IsWebsiteThumbnail": false,
    "NetworkPath": "\\\\files.mycompany.com\\files\\file1.jpg",
    "CDRomPath": null,
    "ImageNumber": null,
    "OrderNumber": null,
    "AccessLevel": null,
    "Comments": "This building is scheduled to be built soon",
    "UploadDate": "0001-01-01T00:00:00",
    "Device": null,
    "latitude": null,
    "longitude": null,
    "ImageHash": null,
    "ImageSizeKB": null,
    "OriginalImageEndpoint": "https://compass.cosential.com/api/images/project/54321/76543",
    "WebsiteImageEndpoint": "https://compass.cosential.com/api/images/project/54321/76543/web",
    "ThumbnailImageEndpoint": "https://compass.cosential.com/api/images/project/54321/76543/thumb"
  },
  {
    "ProjectId": 54321,
    "ProjectName": "Blue Skies Big Building",
    "ProjectNumber": "",
    "ImageId": 76544,
    "ImageName": "file2.jpg",
    "Caption": null,
    "Credit": null,
    "Keywords": null,
    "IsWebsiteImage": false,
    "IsWebsiteThumbnail": false,
    "NetworkPath": null,
    "CDRomPath": null,
    "ImageNumber": null,
    "OrderNumber": null,
    "AccessLevel": null,
    "Comments": null,
    "UploadDate": "0001-01-01T00:00:00",
    "Device": null,
    "latitude": null,
    "longitude": null,
    "ImageHash": null,
    "ImageSizeKB": null,
    "OriginalImageEndpoint": "https://compass.cosential.com/api/images/project/54321/76544",
    "WebsiteImageEndpoint": "https://compass.cosential.com/api/images/project/54321/76544/web",
    "ThumbnailImageEndpoint": "https://compass.cosential.com/api/images/project/54321/76544/thumb"
  }
]

Now that we have the metadata objects created, image data can be sent using an HTTP PUT call to the OriginalImageEndpoint found in the metadata object. The endpoint is /api/images/project/<projectId>/<imageId>

There are several different ways to upload the image data.

  • Specify the url parameter in the query string to update the image from a public URL
  • Send the image data using Multipart form data
  • Speicify the Content-Type header of application/json to send the image as a base64 encoded string in a JSON object

Example Request using a URL parameter

    curl -X PUT \
    -H x-compass-token:b3d83cd6-9cd2-4f2a-a3e5-911e94025ecd \ 
    -H "Content-Type: application/x-www-form-urlencoded" -d '' \
    https://compass.cosential.com/api/images/project/54321/76543?url=https%3a%2f%2fcompass.cosential.com%2fcontent%2fimages%2flogo.png

Example Response

[200 OK]

Example Request sending a file using multipart form data

    curl -X PUT \
    -H x-compass-token:b3d83cd6-9cd2-4f2a-a3e5-911e94025ecd \
    -H "Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW" 
    -F "data=[object Object]" \
    https://compass.cosential.com/api/images/project/54321/76543

Example Response

[200 OK]

Example Request sending a JSON object with base64 encoded data

    curl -X PUT \
    -H x-compass-token:b3d83cd6-9cd2-4f2a-a3e5-911e94025ecd \
    -H "Content-Type: application/json" \
    -d '{
        "ContentType": "image/jpeg",
        "Data": "/9j/4AAQSkZJRgABAQEAAAAAAAD/9k="
    }' \
    https://compass.cosential.com/api/images/project/54321/76543

Example Response

[200 OK]

Reading Project Images

Project images are read using one of the following endpoints

  • Original image: /api/images/project/<projectId>/<imageId>
  • Sized for web: /api/images/project/<projectId>/<imageId>/web
  • Thumbnail: /api/images/project/<projectId>/<imageId>/thumb

The web and thumbnail endpoints accept the following optional URL paramaters:

  • maxHeight: specifies the max height of the image.
  • maxWidth: specifies the max width of the image. If maxWidth is supplied, maxHeight is ignored.
  • jpegQuality: applies only when the image is a jpeg. Quality is scaled from 1 to 100.
If a maxHeight or maxWidth is specified, images are scaled down and aspect ratio is always preserved. An image is never scaled to be larger than the original image.

The HTTP Accept Header is used to get the image in different formats. The supported formats are:

  • application/json Image data as a JSON object with the image binary base64 encoded
  • image/jpeg Get a jpeg image
  • image/png Get a png image
  • image/gif Get a gif image
  • image/tiff Get a tiff image

Example Request Accepting a JSON object

    curl -X GET -H Content-Type:application/json \
    -H x-compass-token:b3d83cd6-9cd2-4f2a-a3e5-911e94025ecd \
    -H Accept:application/json \
    https://compass.cosential.com/api/images/project/54321/76543/web?maxWidth=100

Example Response

{
  "ContentType": "image/jpeg",
  "Data": "/9j/4AAQSkZJRgABAgEAAAAAAAD/="
}

Example Request Accepting a jpeg image

    curl -X GET -H Content-Type:application/json \
    -H x-compass-token:b3d83cd6-9cd2-4f2a-a3e5-911e94025ecd \
    -H Accept:image/jpeg \
    https://compass.cosential.com/api/images/project/54321/76543/thumb?maxHeight=400&jpegQuality=50

Example Response

[binary data]

Updating Project Image Data

Two different endpoints exist for project image data. You can use the endpoint /api/projects/<projectId>/images/<imageId> for updating project image metadata, and you can use the endpoint /api/images/project/<projectId>/<imageId> to upload the image binary data.

Example Request updating Image Metadata

    curl -X PUT \
    -H Content-Type:application/json \
    -H x-compass-token:b3d83cd6-9cd2-4f2a-a3e5-911e94025ecd \
    -d '{
            "Caption": "Big Building",
            "Keywords": "building,construction,blue,sky,ground",
            "IsWebsiteImage": true,
            "IsWebsiteThumbnail": false,
            "Comments": "This building project has started"
    }' https://compass.cosential.com/api/projects/54321/images/76543

Response

  {
    "ProjectId": 54321,
    "ProjectName": "Blue Skies Big Building",
    "ProjectNumber": "",
    "ImageId": 76543,
    "ImageName": "file1.jpg",
    "Caption": "Big Building",
    "Credit": null,
    "Keywords": "building,construction,blue,sky,ground",
    "IsWebsiteImage": true,
    "IsWebsiteThumbnail": false,
    "NetworkPath": "\\\\files.mycompany.com\\files\\file1.jpg",
    "CDRomPath": null,
    "ImageNumber": null,
    "OrderNumber": null,
    "AccessLevel": null,
    "Comments": "This building project has started",
    "UploadDate": "0001-01-01T00:00:00",
    "Device": null,
    "latitude": null,
    "longitude": null,
    "ImageHash": null,
    "ImageSizeKB": null,
    "OriginalImageEndpoint": "https://compass.cosential.com/api/images/project/54321/76543",
    "WebsiteImageEndpoint": "https://compass.cosential.com/api/images/project/54321/76543/web",
    "ThumbnailImageEndpoint": "https://compass.cosential.com/api/images/project/54321/76543/thumb"
  }

Updating Image Data

There are several different ways to update the image data.

  • Specify the url parameter in the query string to update the image from a public URL
  • Send the image data using Multipart form data
  • Speicify the Content-Type header of application/json to send the image as a base64 encoded string in a JSON object

Example Request using a URL parameter

    curl -X PUT \
    -H x-compass-token:b3d83cd6-9cd2-4f2a-a3e5-911e94025ecd \ 
    -H "Content-Type: application/x-www-form-urlencoded" -d '' \
    https://compass.cosential.com/api/images/project/54321/76543?url=https%3a%2f%2fcompass.cosential.com%2fcontent%2fimages%2flogo.png

Example Response

[200 OK]

Example Request sending a file using multipart form data

    curl -X PUT \
    -H x-compass-token:b3d83cd6-9cd2-4f2a-a3e5-911e94025ecd \
    -H "Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW" 
    -F "data=[object Object]" \
    https://compass.cosential.com/api/images/project/54321/76543

Example Response

[200 OK]

Example Request sending a JSON object with base64 encoded data

    curl -X PUT \
    -H x-compass-token:b3d83cd6-9cd2-4f2a-a3e5-911e94025ecd \
    -H "Content-Type: application/json" \
    -d '{
        "ContentType": "image/jpeg",
        "Data": "/9j/4AAQSkZJRgABAQEAAAAAAAD/9k="
    }' \
    https://compass.cosential.com/api/images/project/54321/76543

Example Response

[200 OK]

Delete Project Images

An HTTP DELETE request to the image metadata endpoint will delete the metadata AND the image itself. The image metadata endpoint is: /api/projects/<projectId>/images/<imageId>

Example Request

    curl -X DELETE \
    -H x-compass-token:b3d83cd6-9cd2-4f2a-a3e5-911e94025ecd \ 
    https://compass.cosential.com/api/projects/54321/images/76543

Example Response

[200 OK]

The standard list and search parameters are supported to list and search project image metadata for a specific project at: /api/projects/<projectId>/images.

Also, the standard list and search parameters are supported to list and search ALL project image metadata at: /api/projects/images

Example Search for all Project Images where IsWebsiteImage is true

    curl -X GET -H Content-Type:application/json \
    -H x-compass-token:b3d83cd6-9cd2-4f2a-a3e5-911e94025ecd \
    https://compass.cosential.com/api/projects/images/search?q=IsWebsiteImage:true

Example Response

[
  {
    "ProjectId": 54321,
    "ProjectName": "Blue Skies Big Building",
    "ProjectNumber": "",
    "ImageId": 76543,
    "ImageName": "file1.jpg",
    "Caption": "Big Building Site",
    "Credit": null,
    "Keywords": "building,construction,blue,sky",
    "IsWebsiteImage": true,
    "IsWebsiteThumbnail": false,
    "NetworkPath": "\\\\files.mycompany.com\\files\\file1.jpg",
    "CDRomPath": null,
    "ImageNumber": null,
    "OrderNumber": null,
    "AccessLevel": null,
    "Comments": "This building is scheduled to be built soon",
    "UploadDate": "0001-01-01T00:00:00",
    "Device": null,
    "latitude": null,
    "longitude": null,
    "ImageHash": null,
    "ImageSizeKB": null,
    "OriginalImageEndpoint": "https://compass.cosential.com/api/images/project/54321/76543",
    "WebsiteImageEndpoint": "https://compass.cosential.com/api/images/project/54321/76543/web",
    "ThumbnailImageEndpoint": "https://compass.cosential.com/api/images/project/54321/76543/thumb"
  },
  {
    "ProjectId": 54321,
    "ProjectName": "Blue Skies Big Building",
    "ProjectNumber": "",
    "ImageId": 76544,
    "ImageName": "file2.jpg",
    "Caption": null,
    "Credit": null,
    "Keywords": null,
    "IsWebsiteImage": true,
    "IsWebsiteThumbnail": false,
    "NetworkPath": null,
    "CDRomPath": null,
    "ImageNumber": null,
    "OrderNumber": null,
    "AccessLevel": null,
    "Comments": null,
    "UploadDate": "0001-01-01T00:00:00",
    "Device": null,
    "latitude": null,
    "longitude": null,
    "ImageHash": null,
    "ImageSizeKB": null,
    "OriginalImageEndpoint": "https://compass.cosential.com/api/images/project/54321/76544",
    "WebsiteImageEndpoint": "https://compass.cosential.com/api/images/project/54321/76544/web",
    "ThumbnailImageEndpoint": "https://compass.cosential.com/api/images/project/54321/76544/thumb"
  }
]

Creating Personnel Images

Personnel images are created with two or more API calls. The first call is to create one or more personnel image metadata objects using the endpoint /api/personnel/<personnelId>/images. Once the metadata is created, you can use the endpoint /api/images/personnel/<personnelId>/<imageId> to upload the image binary data.

Example Request creating 2 Image Metadata Objects

    curl -X POST -H Content-Type:application/json \
    -H x-compass-token:b3d83cd6-9cd2-4f2a-a3e5-911e94025ecd \
    -d '[{
            "ImageName": "file1.jpg",
            "Caption": "Our Founder",
            "Keywords": "building,construction,blue,sky",
            "NetworkPath": "\\\\files.mycompany.com\\files\\file1.jpg",
            "Comments": "Needs no comment."
        },{
            "ImageName": "file2.jpg"
    }]' https://compass.cosential.com/api/personnel/54321/images

Response

    
        [
        {
        "PersonnelId": 54321,
        "ImageId": 76543,
        "ImageName": "file1.jpg",
        "Caption":  "Our Founder",
        "Credit": null,
        "Keywords": "building,construction,blue,sky",
        "NetworkPath": "\\\\files.mycompany.com\\files\\file1.jpg",
        "CDRomPath": null,
        "OrderNumber": null,
        "Comments": "Needs no comment.",
        "UploadDate": "0001-01-01T00:00:00",
        "Device": null,
        "latitude": null,
        "longitude": null,
        "ImageHash": null,
        "ImageSizeKB": null,
        "OriginalImageEndpoint": "https://compass.cosential.com/api/images/personnel/54321/76543",
        "WebsiteImageEndpoint": null,
        "ThumbnailImageEndpoint": "https://compass.cosential.com/api/images/personnel/54321/76543/thumb"
        },
        {
        "PersonnelId": 659741,
        "ImageId": 320045,
        "ImageName": "file2.jpg",
        "Caption": null,
        "Credit": null,
        "Keywords": null,
        "NetworkPath": null,
        "CDRomPath": null,
        "OrderNumber": null,
        "Comments": null,
        "UploadDate": "2018-03-07T12:22:00",
        "Device": null,
        "latitude": null,
        "longitude": null,
        "ImageHash": null,
        "ImageSizeKB": null,
        "OriginalImageEndpoint": "https://compass.cosential.com/api/images/personnel/659741/320045",
        "WebsiteImageEndpoint": null,
        "ThumbnailImageEndpoint": "https://compass.cosential.com/api/images/personnel/659741/320045/thumb"
        }
        ]
    

Now that we have the metadata objects created, image data can be sent using an HTTP PUT call to the OriginalImageEndpoint found in the metadata object. The endpoint is /api/images/personnel/<personnelId>/<imageId>

There are several different ways to upload the image data.

  • Specify the url parameter in the query string to update the image from a public URL
  • Send the image data using Multipart form data
  • Speicify the Content-Type header of application/json to send the image as a base64 encoded string in a JSON object

Example Request using a URL parameter

    curl -X PUT \
    -H x-compass-token:b3d83cd6-9cd2-4f2a-a3e5-911e94025ecd \ 
    -H "Content-Type: application/x-www-form-urlencoded" -d '' \
    https://compass.cosential.com/api/images/personnel/54321/76543?url=https%3a%2f%2fcompass.cosential.com%2fcontent%2fimages%2flogo.png

Example Response

[200 OK]

Example Request sending a file using multipart form data

    curl -X PUT \
    -H x-compass-token:b3d83cd6-9cd2-4f2a-a3e5-911e94025ecd \
    -H "Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW" 
    -F "data=[object Object]" \
    https://compass.cosential.com/api/images/personnel/54321/76543

Example Response

[200 OK]

Example Request sending a JSON object with base64 encoded data

    curl -X PUT \
    -H x-compass-token:b3d83cd6-9cd2-4f2a-a3e5-911e94025ecd \
    -H "Content-Type: application/json" \
    -d '{
        "ContentType": "image/jpeg",
        "Data": "/9j/4AAQSkZJRgABAQEAAAAAAAD/9k="
    }' \
    https://compass.cosential.com/api/images/personnel/54321/76543

Example Response

[200 OK]

Reading Personnel Images

Personnel images are read using one of the following endpoints

  • Original image: /api/images/personnel/<personnelId>/<imageId>
  • Sized for web: /api/images/personnel/<personnelId>/<imageId>/web
  • Thumbnail: /api/images/personnel/<personnelId>/<imageId>/thumb

The web and thumbnail endpoints accept the following optional URL paramaters:

  • maxHeight: specifies the max height of the image.
  • maxWidth: specifies the max width of the image. If maxWidth is supplied, maxHeight is ignored.
  • jpegQuality: applies only when the image is a jpeg. Quality is scaled from 1 to 100.
If a maxHeight or maxWidth is specified, images are scaled down and aspect ratio is always preserved. An image is never scaled to be larger than the original image.

The HTTP Accept Header is used to get the image in different formats. The supported formats are:

  • application/json Image data as a JSON object with the image binary base64 encoded
  • image/jpeg Get a jpeg image
  • image/png Get a png image
  • image/gif Get a gif image
  • image/tiff Get a tiff image

Example Request Accepting a JSON object

    curl -X GET -H Content-Type:application/json \
    -H x-compass-token:b3d83cd6-9cd2-4f2a-a3e5-911e94025ecd \
    -H Accept:application/json \
    https://compass.cosential.com/api/images/personnel/54321/76543/web?maxWidth=100

Example Response

{
  "ContentType": "image/jpeg",
  "Data": "/9j/4AAQSkZJRgABAgEAAAAAAAD/="
}

Example Request Accepting a jpeg image

    curl -X GET -H Content-Type:application/json \
    -H x-compass-token:b3d83cd6-9cd2-4f2a-a3e5-911e94025ecd \
    -H Accept:image/jpeg \
    https://compass.cosential.com/api/images/personnel/54321/76543/thumb?maxHeight=400&jpegQuality=50

Example Response

[binary data]

Updating Personnel Image Data

Two different endpoints exist for personnel image data. You can use the endpoint /api/personnel/<personnelId>/images/<imageId> for updating personnel image metadata, and you can use the endpoint /api/images/personnel/<personnelId>/<imageId> to upload the image binary data.

Example Request updating Image Metadata

    
        curl -X PUT \
        -H Content-Type:application/json \
        -H x-compass-token:b3d83cd6-9cd2-4f2a-a3e5-911e94025ecd \
        -d '{
        "Caption": "Rock Legend",
        "Keywords": ""Gibson SG, AC/DC",
        "Comments": "This building is about to rock."
        }' https://compass.cosential.com/api/personnel/659741/images/320044
    

Response

    
        {
        "PersonnelId": 659741,
        "ImageId": 320044,
        "ImageName": "angus_young.jpg",
        "Caption": "Rock Legend",
        "Credit": null,
        "Keywords": "Gibson SG, AC/DC",
        "NetworkPath": null,
        "CDRomPath": null,
        "OrderNumber": null,
        "Comments": "This building is about to rock.",
        "UploadDate": "2018-03-07T12:22:00",
        "Device": null,
        "latitude": null,
        "longitude": null,
        "ImageHash": null,
        "ImageSizeKB": null,
        "OriginalImageEndpoint": "https://compass.cosential.com/api/images/personnel/659741/320044",
        "WebsiteImageEndpoint": null,
        "ThumbnailImageEndpoint": "https://compass.cosential.com/api/images/personnel/659741/320044/thumb"
        }
    

Updating Image Data

There are several different ways to update the image data.

  • Specify the url parameter in the query string to update the image from a public URL
  • Send the image data using Multipart form data
  • Speicify the Content-Type header of application/json to send the image as a base64 encoded string in a JSON object

Example Request using a URL parameter

    curl -X PUT \
    -H x-compass-token:b3d83cd6-9cd2-4f2a-a3e5-911e94025ecd \ 
    -H "Content-Type: application/x-www-form-urlencoded" -d '' \
    https://compass.cosential.com/api/images/personnel/54321/76543?url=https%3a%2f%2fcompass.cosential.com%2fcontent%2fimages%2flogo.png

Example Response

[200 OK]

Example Request sending a file using multipart form data

    curl -X PUT \
    -H x-compass-token:b3d83cd6-9cd2-4f2a-a3e5-911e94025ecd \
    -H "Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW" 
    -F "data=[object Object]" \
    https://compass.cosential.com/api/images/personnel/54321/76543

Example Response

[200 OK]

Example Request sending a JSON object with base64 encoded data

    curl -X PUT \
    -H x-compass-token:b3d83cd6-9cd2-4f2a-a3e5-911e94025ecd \
    -H "Content-Type: application/json" \
    -d '{
        "ContentType": "image/jpeg",
        "Data": "/9j/4AAQSkZJRgABAQEAAAAAAAD/9k="
    }' \
    https://compass.cosential.com/api/images/personnel/54321/76543

Example Response

[200 OK]

Delete Personnel Images

An HTTP DELETE request to the image metadata endpoint will delete the metadata AND the image itself. The image metadata endpoint is: /api/personnel/<personnelId>/images/<imageId>

Example Request

    curl -X DELETE \
    -H x-compass-token:b3d83cd6-9cd2-4f2a-a3e5-911e94025ecd \ 
    https://compass.cosential.com/api/personnel/54321/images/76543

Example Response

[200 OK]

The standard list and search parameters are supported to list and search personnel image metadata for a specific personnel at: /api/personnel/<personnelId>/images.

Also, the standard list and search parameters are supported to list and search ALL personnel image metadata at: /api/personnel/images

Example Search for all Personnel Images where IsWebsiteImage is true

    
        curl -X GET -H Content-Type:application/json \
        -H x-compass-token:b3d83cd6-9cd2-4f2a-a3e5-911e94025ecd \
        https://compass.cosential.com/api/personnel/images/search?q=ImageName:angus
    

Example Response

    
        [
        {
        "PersonnelId": 659741,
        "ImageId": 320044,
        "ImageName": "angus_young.jpg",
        "Caption": null,
        "Credit": null,
        "Keywords": null,
        "NetworkPath": null,
        "CDRomPath": null,
        "OrderNumber": null,
        "Comments": null,
        "UploadDate": "2018-03-07T12:22:00",
        "Device": null,
        "latitude": null,
        "longitude": null,
        "ImageHash": null,
        "ImageSizeKB": null,
        "OriginalImageEndpoint": "https://compass.cosential.com/api/images/personnel/659741/320044",
        "WebsiteImageEndpoint": null,
        "ThumbnailImageEndpoint": "https://compass.cosential.com/api/images/personnel/659741/320044/thumb"
        },
        {....}
        ]
    

Image Urls

Profile Pictures for Contacts and Personnel can be viewed through a URL with a HTTP GET request to the entity

The property ProfileImageUrl contains a URL providing anonymous access to that image for up to 1 hour after the request is made

ProfileImageUrls with a value of null indicates a profile image currently does not exist

Example Request Getting a Contact Profile Image Url

    curl -X GET -H Content-Type:application/json \
    -H x-compass-token:b3d83cd6-9cd2-4f2a-a3e5-911e94025ecd \
    https://compass.cosential.com/api/contacts/54321

Example Response


{
    ...,
    "ProfileImageUrl": "/api/images/contact/54321/ProfilePicture/1255db02-05c0-458c"
}