Community discussions

MikroTik App
 
bassist
just joined
Topic Author
Posts: 12
Joined: Fri Jun 29, 2012 4:33 pm

Setting system identity through REST API

Mon Jun 27, 2022 4:10 pm

I'm trying to set /system/identity through the REST API, but struggling to get it to set.
curl -k -u admin: -X PATCH https://localhost/rest/system/identity --data '{"name":"newName"}' -H "content-type: application/json"
{"detail":"missing or invalid resource identifier","error":400,"message":"Bad Request"}%
curl -k -u admin: -X PATCH https://localhost/rest/system/identity/set --data '{"name":"newName"}' -H "content-type: application/json"
{"detail":"missing or invalid resource identifier","error":400,"message":"Bad Request"}%
Any pointers here? Is this even possible?
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 7038
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: Setting system identity through REST API

Mon Jun 27, 2022 4:34 pm

Use POST to set this and similar parameters
https://help.mikrotik.com/docs/display/ ... STAPI-POST
 
bassist
just joined
Topic Author
Posts: 12
Joined: Fri Jun 29, 2012 4:33 pm

Re: Setting system identity through REST API

Fri Jul 01, 2022 2:29 pm

Ahh thanks that worked:
curl -k -u admin: -X POST https://localhost/rest/system/identity/set --data '{"name":"NewIdentity"}' -H "content-type: application/json"
[]%
curl -k -u admin: -X GET https://localhost/rest/system/identity
{"name":"NewIdentity"}%

Who is online

Users browsing this forum: diamuxin, JDF, philipp84 and 23 guests