Forum Discussion
devnullNZ
Nimbostratus
Jun 19, 2017Understanding PATCH syntax when constructing update requests
Would love to see some practical examples of syntax use when using the iControl REST API.
I'm trying to modify a datagroup data value via the API, but failing.
Using Postman, successfully auth'd...
Satoshi_Toyosa1
Jul 11, 2017Ret. Employee
I believe you are missing curly brackets around the name/value object. i.e.,
{"records":[ {"name":"default", "data":"virt_host2"} ]}
Example:
- Getting the datagroup (equivalent to
😞tmsh list ltm data-group internal images
curl -sku admin: https:///mgmt/tm/ltm/data-group/internal/images
{ kind: 'tm:ltm:data-group:internal:internalstate',
name: 'images',
fullPath: 'images',
generation: 299,
selfLink: 'https://localhost/mgmt/tm/ltm/data-group/internal/images?ver=11.6.1',
type: 'string',
records: [ { name: 'ext1', data: '.ppm' } ]
}
- Modify (equivalent to
)modify ltm data-group internal images records replace-all-with {ext1 {data .png} }
curl -sku admin: https:///mgmt/tm/ltm/data-group/internal/images \
-X PATCH -H "Content-type: application/json" \
-d '{"records":[ {"name": "ext1", "data":".png"} ]}'
{ kind: 'tm:ltm:data-group:internal:internalstate',
name: 'images',
fullPath: 'images',
generation: 306,
selfLink: 'https://localhost/mgmt/tm/ltm/data-group/internal/images?ver=11.6.1',
type: 'string',
records: [ { name: 'ext1', data: '.png' } ]
}
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects