New-ITGlueFlexibleAsset

SYNOPSIS

Create a flexible asset / POST /organizations/{organization_id}/relationships/flexible_assets

SYNTAX

Create (Default)

New-ITGlueFlexibleAsset -Data <Object> [-Raw] [-WhatIf] [-Confirm]

ByOrganization

New-ITGlueFlexibleAsset [-OrganizationId] <long> -Data <Object> [-Raw] [-WhatIf] [-Confirm]

ALIASES

This cmdlet has the following aliases,

  • None

DESCRIPTION

Parameter set [ Create ] - The New-ITGlueFlexibleAsset cmdlet invokes the POST method of the /flexible_assets endpoint (Create a flexible asset)

Creates a new flexible asset.

If there are any required fields in the flexible asset type, they will need to be included in the request.

The request body must contain a JSON object, for example:

{ “data”: { “type”: “flexible-assets”, “attributes”: { “organization-id”: 2, “flexible-asset-type-id”: 33, “archived”: true, “traits”: { “domains”: 569, “type”: “Exchange 2013”, “email-servers”: 457, “location”: “On-Premises”, “inbound-delivery”: “Office 365”, “webmail-url”: “https://email.example.com” } } } }

To create multiple flexible assets, the JSON object will look something like:

{ “data”: [ { “type”: “flexible-assets”, “attributes”: { “flexible-asset-type-id”: 23, “traits”: { “trait1”: “some text value”, “trait2”: “some another text value” } } }, { “type”: “flexible-assets”, “attributes”: { “flexible-asset-type-id”: 23, “traits”: { “trait1”: “some text value”, “trait2”: “some another text value” } } } ] }

Bulk creation works only with nested route

Files can be encoded and passed in JSON format for direct upload to a flexible asset with an Upload field. The file has to be strict encoded. You need to convert it using something like www.freeformatter.com/base64-encoder.html. This produces a string of text that goes into the ‘content’ field. For example:

“traits”: { “file”: { “content”: “R0lGODlhABAQAIAAAAAAAP///yH7BAEAAAAALAAAAAAEAABAAAIBRAA5”, “file_name”: “test.png” } }

Multipart requests can also be used when POST/PATCH flexible assets with uploaded file. Here is a sample curl request:

curl -v
-H “Content-Type: multipart/form-data”
-H “x-api-key: ITG.**********”
-X POST
-F “data[type]=flexible-assets”
-F “data[attributes][organization-id]=2”
-F “data[attributes][flexible-asset-type-id]=30”
-F “data[attributes][traits][file]=@test.png”
http://api.itglue.com/api/flexible_assets

Parameter set [ ByOrganization ] - The New-ITGlueFlexibleAsset cmdlet invokes the POST method of the /organizations/{organization_id}/relationships/flexible_assets endpoint (POST /organizations/{organization_id}/relationships/flexible_assets)

Creates a new flexible asset.

If there are any required fields in the flexible asset type, they will need to be included in the request.

The request body must contain a JSON object, for example:

{ “data”: { “type”: “flexible-assets”, “attributes”: { “organization-id”: 2, “flexible-asset-type-id”: 33, “archived”: true, “traits”: { “domains”: 569, “type”: “Exchange 2013”, “email-servers”: 457, “location”: “On-Premises”, “inbound-delivery”: “Office 365”, “webmail-url”: “https://email.example.com” } } } }

To create multiple flexible assets, the JSON object will look something like:

{ “data”: [ { “type”: “flexible-assets”, “attributes”: { “flexible-asset-type-id”: 23, “traits”: { “trait1”: “some text value”, “trait2”: “some another text value” } } }, { “type”: “flexible-assets”, “attributes”: { “flexible-asset-type-id”: 23, “traits”: { “trait1”: “some text value”, “trait2”: “some another text value” } } } ] }

Bulk creation works only with nested route

Files can be encoded and passed in JSON format for direct upload to a flexible asset with an Upload field. The file has to be strict encoded. You need to convert it using something like www.freeformatter.com/base64-encoder.html. This produces a string of text that goes into the ‘content’ field. For example:

“traits”: { “file”: { “content”: “R0lGODlhABAQAIAAAAAAAP///yH7BAEAAAAALAAAAAAEAABAAAIBRAA5”, “file_name”: “test.png” } }

Multipart requests can also be used when POST/PATCH flexible assets with uploaded file. Here is a sample curl request:

curl -v
-H “Content-Type: multipart/form-data”
-H “x-api-key: ITG.**********”
-X POST
-F “data[type]=flexible-assets”
-F “data[attributes][organization-id]=2”
-F “data[attributes][flexible-asset-type-id]=30”
-F “data[attributes][traits][file]=@test.png”
http://api.itglue.com/api/flexible_assets

This is a write function. It changes data in ITGlue. Use -WhatIf to see the request without sending it

EXAMPLES

EXAMPLE 1

New-ITGlueFlexibleAsset -Data @{} -WhatIf

Shows the POST request to the /flexible_assets endpoint without sending it

EXAMPLE 2

New-ITGlueFlexibleAsset -OrganizationId 12345 -Data @{} -WhatIf

Shows the POST request to the /organizations/{organization_id}/relationships/flexible_assets 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) - flexible_assets
  • attributes (object):
    • archived (boolean)
    • flexible_asset_type_id (integer)
    • organization_id (integer)
    • restricted (boolean)
    • traits (object) - A hash of key value pairs for the traits of this asset. Values can be arrays. The key has to be an available field key from the specified flexible asset type.
Type: System.Object
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: ByOrganization
  Position: Named
  IsRequired: true
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
- Name: Create
  Position: Named
  IsRequired: true
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-OrganizationId

Defines the ID of the organization

Type: System.Int64
DefaultValue: 0
SupportsWildcards: false
Aliases:
- organization_id
ParameterSets:
- Name: ByOrganization
  Position: 0
  IsRequired: true
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: true
  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

System.Int64

OUTPUTS

NOTES

Endpoint : POST /flexible_assets Endpoint : POST /organizations/{organization_id}/relationships/flexible_assets