PaloAltoNetworks / PaloAltoNetworks/pan.dev

mobile-agent API: POST/PUT/DELETE endpoints return JSON array instead of single object

Open
#1,092 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
MDX
Stars
78
Forks
88
Avg merge
5d 17h
Merged PRs (30d)
18

Description

Describe the bug

Several mobile-agent API endpoints (/config/mobile-agent/v1) return a JSON array [{...}] for POST, PUT, and DELETE operations, instead of a single JSON object {...} as declared in the OpenAPI specs (link) and in the API docs (link). This is inconsistent with both the spec and the behavior of other SCM API modules (e.g., config/objects/v1), which correctly return single objects.

Expected behavior

Per the OpenAPI spec and official documentation, POST/PUT/DELETE endpoints should return a single JSON object, matching the behavior of other SCM modules. For example, POST /config/objects/v1/addresses correctly returns:
{"id":"cac8a0e8-...","name":"my-address","folder":"Shared","fqdn":"example.com"}

Current behavior

All POST, PUT, and DELETE endpoints in the mobile-agent module wrap the response in a JSON array:
[{"name":"my-profile","folder":"Mobile Users","authentication_override":{}}]

instead of returning a single object:
{"name":"my-profile","folder":"Mobile Users","authentication_override":{}}

GET endpoints are not affected and correctly return JSON objects.

Steps to reproduce

  1. Obtain a bearer token:

curl -s -X POST "https://auth.apps.paloaltonetworks.com/auth/v1/oauth2/access_token" -u "CLIENT_ID:CLIENT_SECRET" -H "Content-Type: application/x-www-form-urlencoded" -d "grant_type=client_credentials&scope=tsg_id:YOUR_TSG_ID"

  1. Set the token as a variable (copy the access_token value from the response):

set TOKEN=eyJ0eXAiOiJKV1Qi...

  1. Create a tunnel profile via mobile-agent:

curl -s -X POST "https://api.strata.paloaltonetworks.com/config/mobile-agent/v1/tunnel-profiles?folder=Mobile+Users" -H "Authorization: Bearer %TOKEN%" -H "Content-Type: application/json" -d "{"name":"test-bug-report"}"

Response:
[{"name":"test-bug-report","folder":"Mobile Users","authentication_override":{}}]

  1. Create an address via objects:

curl -s -X POST "https://api.strata.paloaltonetworks.com/config/objects/v1/addresses?folder=Shared" -H "Authorization: Bearer %TOKEN%" -H "Content-Type: application/json" -d "{"name":"test-bug-report","fqdn":"example.com"}"

Response:
{"id":"abc-123","name":"test-bug-report","folder":"Shared","fqdn":"example.com"}

  1. Cleanup — delete both test resources:

curl -s -X DELETE "https://api.strata.paloaltonetworks.com/config/mobile-agent/v1/tunnel-profiles?folder=Mobile+Users&name=test-bug-report" -H "Authorization: Bearer %TOKEN%"
curl -s -X DELETE "https://api.strata.paloaltonetworks.com/config/objects/v1/addresses?folder=Shared&name=test-bug-report" -H "Authorization: Bearer %TOKEN%"

Context

I am trying to add the mobile-agent endpoints to the scm-go SDK (link) by generating the client code from the OpenAPI spec using openapi-generator. However, because the API returns JSON arrays instead of single objects, the generated deserialization code fails with:
json: cannot unmarshal array into Go value of type map[string]interface{}

The operations succeed server-side (resources are created/updated/deleted), but the SDK cannot parse the response. This forces workarounds such as ignoring the response body entirely and verifying success via separate GET/List calls, which is unreliable and prevents proper error handling.

Your Environment

  • Date tested: February 2026
  • OS: Windows 11 entreprise 10.0.22631
  • OpenAPI version: 3.0.0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the mobile-agent-feb-v1.yaml OpenAPI spec and reproduce the POST, PUT, and DELETE responses using the supplied curl examples. Compare the declared single-object responses with the generated scm-go deserialization behavior; done means those operations return objects that the generated client can parse without array-to-map errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, openapi
Domain
api, backend-api-design
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.