Mutation
mutation UpsertCompany($input: UpsertCompanyInput!) {
upsertCompany(input: $input) {
company {
id
name
logoUrl
domainName
createdAt {
unixTimestamp
iso8601
}
createdBy {
__typename
... on UserActor {
__typename
}
}
}
result
error {
message
type
code
fields {
field
message
type
}
}
}
}Variables
{
"input": {
"identifier": {},
"name": "string",
"domainName": "string"
}
}Response
{
"data": {
"upsertCompany": {
"company": {
"id": "id",
"name": "string",
"logoUrl": "string",
"domainName": "string",
"createdAt": {
"unixTimestamp": "string",
"iso8601": "string"
},
"createdBy": {
"__typename": "UserActor"
}
},
"result": "UPDATED",
"error": {
"message": "string",
"type": "VALIDATION",
"code": "string",
"fields": [
{
"field": "string",
"message": "string",
"type": "VALIDATION"
}
]
}
}
}
}Mutations
upsertCompany
Creates a new company or updates an existing one identified by companyId or companyDomainName. The output includes a result field of either CREATED or UPDATED so you can tell which happened. You can pass a bare domain (e.g. plain.com) or a full URL and Plain will extract the domain. Requires the company:create and company:edit permissions.
MUTATION
upsertCompany(input: UpsertCompanyInput!): UpsertCompanyOutput!Arguments
input
required
Returns
company
result
error
Mutation
mutation UpsertCompany($input: UpsertCompanyInput!) {
upsertCompany(input: $input) {
company {
id
name
logoUrl
domainName
createdAt {
unixTimestamp
iso8601
}
createdBy {
__typename
... on UserActor {
__typename
}
}
}
result
error {
message
type
code
fields {
field
message
type
}
}
}
}Variables
{
"input": {
"identifier": {},
"name": "string",
"domainName": "string"
}
}Response
{
"data": {
"upsertCompany": {
"company": {
"id": "id",
"name": "string",
"logoUrl": "string",
"domainName": "string",
"createdAt": {
"unixTimestamp": "string",
"iso8601": "string"
},
"createdBy": {
"__typename": "UserActor"
}
},
"result": "UPDATED",
"error": {
"message": "string",
"type": "VALIDATION",
"code": "string",
"fields": [
{
"field": "string",
"message": "string",
"type": "VALIDATION"
}
]
}
}
}
}Was this page helpful?

