Update an organisation
Less than to read
This only applies to Sage cloud applications.
What you can update
You can update the following parameters of an organisation:
name
adminEmail
defaultLanguage
externalId
sageCRMId
For detailed information about these parameters, go to the Onboarding and authentication API reference.
Each of these parameters supports the following operations:
add
– This adds a new value to the specified parameter.remove
– This removes the current value of the specified parameter.replace
– This replaces the current value of the specified parameter with the new one. Using this operation is the same as running aremove
followed by anadd
.
Prerequisites
To update an organisation, you need to know its organisationId
parameter value and have a valid access token for the organisation. After you have completed onboarding, you should have the organisationId
value and a valid access token.
For more information, go to the onboard a Sage application guide.
Configure and send a PATCH request
Send a PATCH request with the following headers and body.
Headers
PATCH /auth-v1/organisations/{organisationId} HTTP/1.1
Host: api-money.sage.com
Content-Type: application/json
Authorization: Bearer {access token}
Where:
-
{organisationId}
is the unique ID of the organisation. -
Bearer {access token}
is the authorization string for your request, where{access token}
is a valid access token for the organisation.
For more information about this REST resource and its parameters, go to the Onboarding and authentication API reference.
Body
[
{
"op" : "replace",
"path" : "{parameter 1}",
"value" : "{new value}"
},
{
"op" : "replace",
"path" : "{parameter 2}",
"value" : "{new value}"
},
{
"op" : "replace",
"path" : "{parameter 3}",
"value" : "{new value}"
}
]
Where:
-
op
specifies the operation you want to perform on the parameter. To simplify the task, we use thereplace
operation. -
path
specifies the name of the parameter whose value you want to update. You can update as many parameters as you need to at a time. -
value
specifies the new parameter value you want to set.
Example requests
Update a single parameter
PATCH /auth-v1/organisations/63abe7bb-ab2b-4e19-baed-16c9cbff0f2a HTTP/1.1
Host: api-money.sage.com
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiJ.eyJjY1ZlcnNpb24iOiIyLjIuMC4wIiwib3JnYW5pc2F0aW9uSWQiOiI2M2FiZTdiYi1hYjJiLTRlMTktYmFlZC0xNmM5Y2JmZjBmMmEiLCJzb3VyY2VQcm9kdWN0Ijoic2FnZS5icmF6aWwub25lIiwia2lkIj25lIioiNa2la2lkI
[
{
"op" : "replace",
"path" : "/name",
"value" : "My organisation"
}
]
This request sets the value of the name
parameter to My organisation
. It updates the organisation whose unique ID is 63abe7bb-ab2b-4e19-baed-16c9cbff0f2a
.
Update several parameters at a time
PATCH /auth-v1/organisations/63abe7bb-ab2b-4e19-baed-16c9cbff0f2a HTTP/1.1
Host: api-money.sage.com
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiJ.eyJjY1ZlcnNpb24iOiIyLjIuMC4wIiwib3JnYW5pc2F0aW9uSWQiOiI2M2FiZTdiYi1hYjJiLTRlMTktYmFlZC0xNmM5Y2JmZjBmMmEiLCJzb3VyY2VQcm9kdWN0Ijoic2FnZS5icmF6aWwub25lIiwia2lkIj25lIioiNa2la2lkI
[
{
"op" : "replace",
"path" : "/name",
"value" : "My organisation"
},
{
"op" : "replace",
"path" : "/adminEmail",
"value" : "[email protected]"
},
{
"op" : "replace",
"path" : "/externalId",
"value" : "my-organisation-id-1"
}
]
This request updates the organisation whose unique ID is 63abe7bb-ab2b-4e19-baed-16c9cbff0f2a
:
- Sets the organisation name to
My organisation
. - Sets the administrator email to
[email protected]
. - Sets the organisation external ID to
my-organisation-id-1
.
Remove a parameter value
PATCH /auth-v1/organisations/927cd098-9b9f-4879-a271-c328a0b5839b HTTP/1.1
Host: api-money.sage.com
Content-Type: application/json
Authorization: Bearer eyJhbGciOiJSUzI1NiJ.eyJjY1ZlcnNpb24iOiIyLjIuMC4wIiwib3JnYW5pc2F0aW9uSWQiOiI2M2FiZTdiYi1hYjJiLTRlMTktYmFlZC0xNmM5Y2JmZjBmMmEiLCJzb3VyY2VQcm9kdWN0Ijoic2FnZS5icmF6aWwub25lIiwia2lkIj25lIioiNa2la2lkI
[
{
"op" : "remove",
"path" : "/externalId"
}
]
This request sets the externalId
parameter value to null
. It updates the organisation whose unique ID is 927cd098-9b9f-4879-a271-c328a0b5839b
.