New-ITGlueDocumentImage
SYNOPSIS
Create a new document image
SYNTAX
__AllParameterSets
New-ITGlueDocumentImage [-Data] <Object> [-Raw] [-WhatIf] [-Confirm]
ALIASES
This cmdlet has the following aliases,
- None
DESCRIPTION
The New-ITGlueDocumentImage cmdlet invokes the POST method of the /document_images endpoint (Create a new document image)
Creates a new document image. Images are placed using the ‘target’ attribute which specifies whether the image is for a gallery or inline in a document.
The image must be uploaded as Base64-encoded content with a file name.
Required attributes:
-
target: { type: ‘gallery’ ‘document’, id: integer } - image.content: Base64-encoded image data
- image.file-name: Original filename with extension
Example request (Gallery image):
{ “data”: { “type”: “document-images”, “attributes”: { “target”: { “type”: “gallery”, “id”: 12 }, “image”: { “content”: “iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==”, “file-name”: “test-image.png” } } } }
Example request (Inline image):
{ “data”: { “type”: “document-images”, “attributes”: { “target”: { “type”: “document”, “id”: 42 }, “image”: { “content”: “iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==”, “file-name”: “inline-diagram.png” } } } }
The response includes URLs for all generated image variants and the target attribute:
{ “data”: { “id”: “17”, “type”: “document-images”, “attributes”: { “name”: “test-image.png”, “size”: 12345, “document-id”: 42, “document-gallery-id”: 12, “target”: { “type”: “gallery”, “id”: 12 }, “original-src”: “https://storage.example.com/developer/images/17/original/test-image.png”, “slim-src”: “https://storage.example.com/developer/images/17/slim/test-image.png”, “thumbnail-src”: “https://storage.example.com/developer/images/17/thumbnail/test-image.png”, “inline-resource-url”: null, “created-at”: “2024-01-10T16:00:00.000Z”, “updated-at”: “2024-01-10T16:00:00.000Z” } } }
Example response (Inline image for use in section content):
{ “data”: { “id”: “18”, “type”: “document-images”, “attributes”: { “name”: “inline-test.png”, “size”: 54321, “document-id”: 42, “document-gallery-id”: null, “target”: { “type”: “document”, “id”: 42 }, “original-src”: “https://storage.example.com/developer/images/18/original/inline-test.png”, “slim-src”: “https://storage.example.com/developer/images/18/slim/inline-test.png”, “thumbnail-src”: “https://storage.example.com/developer/images/18/thumbnail/inline-test.png”, “inline-resource-url”: “/1065811/docs/2288222/developer/images/18”, “created-at”: “2024-01-10T17:00:00.000Z”, “updated-at”: “2024-01-10T17:00:00.000Z” } } }
This is a write function. It changes data in ITGlue. Use -WhatIf to see the request without sending it
EXAMPLES
EXAMPLE 1
New-ITGlueDocumentImage -Data @{} -WhatIf
Shows the POST request to the /document_images endpoint without sending it
PARAMETERS
-Confirm
Prompts you for confirmation before running the cmdlet.
Type: System.Management.Automation.SwitchParameter
DefaultValue: ''
SupportsWildcards: false
Aliases:
- cf
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-Data
Defines the data of the JSON:API request body. Accepts a hashtable, an object, or a JSON string
The value is sent as the data property of the request body, such as @{ type = ‘organizations’; attributes = @{ name = ‘Example’ } }. An object with a single data property & a JSON string are sent as is
Body properties:
- type (string) - document-images
- attributes (object):
- id (integer) - Required identifier for updates
- image (object) - Image data with content and file_name
-
target (object) - Polymorphic target specifying image placement - { type: ‘gallery’ ‘document’, id: integer }
Type: System.Object
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 0
IsRequired: true
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-Raw
Returns the full API response (data, meta, links, & included) instead of only the data
Type: System.Management.Automation.SwitchParameter
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-WhatIf
Runs the command in a mode that only reports what would happen without performing the actions.
Type: System.Management.Automation.SwitchParameter
DefaultValue: ''
SupportsWildcards: false
Aliases:
- wi
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
INPUTS
OUTPUTS
NOTES
Endpoint : POST /document_images