0
votes

With Azure DevOps YAML task "Invoke-HTTP", I keep getting Exception message 'Exception Message: Invalid JavaScript property identifier character: -. Path '', line 1, position 8. (type JsonReaderException)'

Here is the documentation of task:

https://docs.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/http-rest-api?view=azure-devops

The script is as follows: jobs: # Publish resource group artifact - job: invoke_http_for_ase pool: server continueOnError: true steps: # Invoke REST API # Invoke a REST API as a part of your pipeline. - task: InvokeRESTAPI@1 displayName: 'GET Member' inputs: connectionType: 'connectedServiceNameARM' azureServiceConnection: 'ARM-Service-Connection' method: 'GET' headers: '{Content-Type:application/json}' urlSuffix: "subscriptions/xxx/resourceGroups/xxx?api-version=2018-05-01" waitForCompletion: 'true'

And the same works from the designer with the Release Task within the release pipeline.

1
so which character is that? or you dont know?4c74356b41
I am suspecting the parameter: azureServiceConnection, trying it out with no special characters..koushik

1 Answers

0
votes

Indentation is your problem. Scoot every line below "jobs:" to the left, ie:

jobs: - job: invoke_http_for_ase pool: server continueOnError: true steps: # Invoke REST API # Invoke a REST API as a part of your pipeline. - task: InvokeRESTAPI@1 displayName: 'GET Member' inputs: connectionType: 'connectedServiceNameARM' azureServiceConnection: 'ARM-Service-Connection' method: 'GET' headers: '{Content-Type:application/json}' urlSuffix: "subscriptions/xxx/resourceGroups/xxx?api-version=2018-05-01" waitForCompletion: 'true'