editPost

tl;dr: Edit a Post

const mutation = /* GraphQL */ `
  mutation($model: EditPostInput!) {
    editPost(model: $model) {
      success
      post {
        id
        color
        coordinates {
          latitude
          longitude
        }
        isPrivate
        isPublic
        manager {
          ... on UserAssignee {
            userId
          }
        }
        messages {
          attachments {
            id
            fileId
            fileName
          }
          author {
            firstName
            lastName
          }
          authoredById
          body
          createdAt
          id
          savedViews {
            coordinates {
              latitude
              longitude
            }
            bearing
            pitch
            zoom
          }
          source
        }
        number
        permissions {
          assignee {
            ... on UserAssignee {
              userId
            }
          }
          scope
        }
        showOnLayers {
          color
          discipline {
            id
            name
          }
          id
          level {
            id
            name
          }
          name
        }
        subject
        tags {
          isPrimary
          tag {
            id
            name
          }
        }
      }
    }
  }
`;

const body = {
  query: mutation,
  variables: {
    model: {
      id: "$POST_ID", // the ID of the post you want to edit
      color: "#DD2C00", // Hex Color Code for Psot
      coreId: "$PROJECT_ID", // Your Project's ID
      latitude: 32.54417017820198,
      longitude: -96.36386596007037,
      permissions: [
        {scope: "MANAGE", userId: "$CREATED_BY_USER_ID"}
      ],
      messages: [],
      showOnLayerIds: ["$LAYER_ID"],
      savedView: {
        latitude: 32.544167917161815,
        longitude: -96.36654816908501,
        layerIds: ["$LAYER_ID"],
        pitch: $DEGREE_OF_PITCH_YOU_WANT_MAP_TO_HAVE_WHEN_POST_ACTIVATED,
        zoom: $ZOOM_LEVEL_YOU_WANT_MAP_TO_ZOOM_TO_WHEN_POST_ACTIVATED,
      },
      subject: "New Post",
      tags:[]
    }
  }
};

fetch("https://atlasapigateway.bluebeam.com/graphql", {
  "headers": {
    "accept": "application/json, text/plain, */*",
    "authorization": "Bearer $YOUR_ACCESS_TOKEN",
  },
  "body": body,
  "method": "POST",
  "mode": "cors",
  "credentials": "include"
});

Request

Mutation for a project's accessCode by the project's id.

mutation($model: EditPostInput!) {
	editPost(model: $model) {
		success
		post {
			id
			color
			coordinates {
				latitude
				longitude
			}
			isPrivate
			isPublic
			manager {
				... on UserAssignee {
					userId
				}
			}
			messages {
				attachments {
					id
					fileId
					fileName
				}
				author {
					firstName
					lastName
				}
				authoredById
				body
				createdAt
				id
				savedViews {
					coordinates {
						latitude
						longitude
					}
					bearing
					pitch
					zoom
				}
				source
			}
			number
			permissions {
				assignee {
					... on UserAssignee {
						userId
					}
				}
				scope
			}
			showOnLayers {
				color
				discipline {
					id
					name
				}
				id
				level {
					id
					name
				}
				name
			}
			subject
			tags {
				isPrimary
				tag {
					id
					name
				}
			}
		}
	}
}

Variables

NameType
modelEditPostInput ](ref:createpostinput)

(required)

Response

Returns the project's access code.

{
  "data":{
    "editPost":{
      "success":true,
      "post":{
        "id":"$POST_ID",
        "color":"#DD2C00",
        "coordinates":{
          "latitude":32.544170178202,
          "longitude":-96.3638659600704
        },
        "isPrivate":false,
        "isPublic":true,
        "manager":{
          "userId":"$CREATED_BY_USER_ID"
        },
        "messages":[
          {
            "attachments":[
              
            ],
            "author":{
              "firstName":"Zach",
              "lastName":"Wentz"
            },
            "authoredById":"$CREATED_BY_USER_ID",
            "body":"created New Post",
            "createdAt":"2020-09-01T15:21:21.950Z",
            "id":"ea59be2b-1eb5-4b82-9054-60f79d1d17ed",
            "savedViews":[
              {
                "coordinates":{
                  "latitude":32.5441679171618,
                  "longitude":-96.366548169085
                },
                "bearing":0,
                "pitch":0,
                "zoom":17
              }
            ],
            "source":"SYSTEM"
          }
        ],
        "number":71,
        "permissions":[
          {
            "assignee":{
              "userId":"$CREATED_BY_USER_ID"
            },
            "scope":"MANAGE"
          }
        ],
        "showOnLayers":[
          {
            "color":"#212121",
            "discipline":{
              "id":1,
              "name":"Architectural"
            },
            "id":"7087",
            "level":{
              "id":88656,
              "name":"Level 1"
            },
            "name":"Floor Plan"
          }
        ],
        "subject":"New Title",
        "tags":[
          
        ]
      }
    }
  }
}