Skip to content

Commit

Permalink
Fix create external id: Use externalid accept header value instead …
Browse files Browse the repository at this point in the history
…of application/json (#230)

* dev: add missing api spec option

* fix(c8y identity create): add specific accept header to avoid 406 errors
  • Loading branch information
reubenmiller committed Mar 5, 2023
1 parent 79d551f commit 574e828
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 9 deletions.
7 changes: 4 additions & 3 deletions api/spec/json/identity.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"descriptionLong": "Get a collection of external ids related to an existing managed object",
"path": "identity/globalIds/{device}/externalIds",
"accept": "application/vnd.com.nsn.cumulocity.externalIdCollection+json",
"collectionType": "application/vnd.com.nsn.cumulocity.externalId+json",
"collectionType": "application/vnd.com.nsn.cumulocity.externalid+json",
"collectionProperty": "externalIds",
"alias": {
"go": "list",
Expand Down Expand Up @@ -71,7 +71,7 @@
"descriptionLong": "Get an external identity object. An external identify will include the reference to a single device managed object\n",
"method": "GET",
"path": "/identity/externalIds/{type}/{name}",
"accept": "application/vnd.com.nsn.cumulocity.externalId+json",
"accept": "application/vnd.com.nsn.cumulocity.externalid+json",
"alias": {
"go": "get",
"powershell": "Get-ExternalId"
Expand Down Expand Up @@ -187,7 +187,8 @@
"name": "newExternalID",
"method": "POST",
"path": "identity/globalIds/{device}/externalIds",
"accept": "application/vnd.com.nsn.cumulocity.externalId+json",
"addAccept": true,
"accept": "application/vnd.com.nsn.cumulocity.externalid+json",
"description": "Create external identity",
"descriptionLong": "Create a new external id for an existing managed object",
"alias": {
Expand Down
4 changes: 4 additions & 0 deletions api/spec/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,10 @@
"type": "string",
"title": "Partial url i.e. /alarm/alarms"
},
"addAccept": {
"type": "boolean",
"description": "Add an explicit Accept header value if set"
},
"accept": {
"type": "string",
"description": "Accept header value. Data to be returned from the platform. The accept header will also control how the data will be displayed within the PowerShell module"
Expand Down
7 changes: 4 additions & 3 deletions api/spec/yaml/identity.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ endpoints:
descriptionLong: Get a collection of external ids related to an existing managed object
path: identity/globalIds/{device}/externalIds
accept: application/vnd.com.nsn.cumulocity.externalIdCollection+json
collectionType: application/vnd.com.nsn.cumulocity.externalId+json
collectionType: application/vnd.com.nsn.cumulocity.externalid+json
collectionProperty: externalIds
alias:
go: list
Expand Down Expand Up @@ -58,7 +58,7 @@ endpoints:
Get an external identity object. An external identify will include the reference to a single device managed object
method: GET
path: /identity/externalIds/{type}/{name}
accept: application/vnd.com.nsn.cumulocity.externalId+json
accept: application/vnd.com.nsn.cumulocity.externalid+json
alias:
go: get
powershell: Get-ExternalId
Expand Down Expand Up @@ -143,7 +143,8 @@ endpoints:
- name: newExternalID
method: POST
path: identity/globalIds/{device}/externalIds
accept: application/vnd.com.nsn.cumulocity.externalId+json
addAccept: true
accept: application/vnd.com.nsn.cumulocity.externalid+json
description: Create external identity
descriptionLong: Create a new external id for an existing managed object
alias:
Expand Down
1 change: 1 addition & 0 deletions pkg/cmd/identity/create/create.auto.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tools/PSc8y/Public/Get-ExternalId.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Get external identity
$c8yargs = New-ClientArgument -Parameters $PSBoundParameters -Command "identity get"
$ClientOptions = Get-ClientOutputOption $PSBoundParameters
$TypeOptions = @{
Type = "application/vnd.com.nsn.cumulocity.externalId+json"
Type = "application/vnd.com.nsn.cumulocity.externalid+json"
ItemType = ""
BoundParameters = $PSBoundParameters
}
Expand Down
2 changes: 1 addition & 1 deletion tools/PSc8y/Public/Get-ExternalIdCollection.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Get a list of external ids
$ClientOptions = Get-ClientOutputOption $PSBoundParameters
$TypeOptions = @{
Type = "application/vnd.com.nsn.cumulocity.externalIdCollection+json"
ItemType = "application/vnd.com.nsn.cumulocity.externalId+json"
ItemType = "application/vnd.com.nsn.cumulocity.externalid+json"
BoundParameters = $PSBoundParameters
}
}
Expand Down
2 changes: 1 addition & 1 deletion tools/PSc8y/Public/New-ExternalId.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Create external identity (using pipeline)
$c8yargs = New-ClientArgument -Parameters $PSBoundParameters -Command "identity create"
$ClientOptions = Get-ClientOutputOption $PSBoundParameters
$TypeOptions = @{
Type = "application/vnd.com.nsn.cumulocity.externalId+json"
Type = "application/vnd.com.nsn.cumulocity.externalid+json"
ItemType = ""
BoundParameters = $PSBoundParameters
}
Expand Down

0 comments on commit 574e828

Please sign in to comment.