Following the guide here on how to setup compass api events
Created two events, `CUSTOM` and `DEPLOYMENT` using the GraphQL process
example rest api request script
#!/usr/bin/env bashset -eCOMPASS_CLOUD_INSTANCE=my-companyCOMPASS_REST_API_VERSION=v1COMPASS_USER_EMAIL=user@email.comCOMPASS_USER_TOKEN=myLongTokenBlahBlahBalhCOMPASS_BASE_URL="https://$COMPASS_CLOUD_INSTANCE.atlassian.net/gateway/api/compass/$COMPASS_REST_API_VERSION/events"## NOTE: need to create the metric in the UI first, example: https://my-company.atlassian.net/compass/component/asdasdasdasdas-sdsd-sdsd-sdsd-asdasdasdasdsadCOMPASS_CLOUD_ID="aaaaaaaaaa-bbbb-1111-2222-ccccccccccccccc"TIMESTAMP=$(date -u +'%Y-%m-%dT%H:%M:%SZ')COMPASS_CUSTOM_DISPLAY_NAME="display name"COMPASS_CUSTOM_UPDATE_SEQUENCE_NUMBER=215COMPASS_CUSTOM_DESCRIPTION="display description"COMPASS_CUSTOM_URL="https://example.com"## using ari from GraphQL response in setup stepsCOMPASS_CUSTOM_EXTERNAL_EVENT_SOURCE_ID="ari:cloud:compass:long-string:event-source/another-long-string/yet-another-long-string"COMPASS_CUSTOM_CUSTOM_EVENT_PROPERTIES_ID=1COMPASS_CUSTOM_CUSTOM_EVENT_PROPERTIES_ICON=INFO## data needs to be JSON, use JQ for thisCOMPASS_EVENT_JSON_DATA=$( jq -n \ --arg cloudId "$COMPASS_CLOUD_ID" \ --arg cDisplayName "$COMPASS_CUSTOM_DISPLAY_NAME" \ --arg cLastUpdated "$TIMESTAMP" \ --argjson cUpdateSequenceNumber $COMPASS_CUSTOM_UPDATE_SEQUENCE_NUMBER \ --arg cDescription "$COMPASS_CUSTOM_DESCRIPTION" \ --arg cUrl "$COMPASS_CUSTOM_URL" \ --arg cExternalEventSourceId "$COMPASS_CUSTOM_EXTERNAL_EVENT_SOURCE_ID" \ --arg cCustomEventPropertiesId "$COMPASS_CUSTOM_CUSTOM_EVENT_PROPERTIES_ID" \ --arg cCustomEventPropertiesIcon "$COMPASS_CUSTOM_CUSTOM_EVENT_PROPERTIES_ICON" \ '{cloudId: $cloudId, event: {custom: {displayName: $cDisplayName, lastUpdated: $cLastUpdated, updateSequenceNumber: $cUpdateSequenceNumber, description: $cDescription, url: $cUrl, externalEventSourceId: $cExternalEventSourceId, customEventProperties: {id: $cCustomEventPropertiesId, icon: $cCustomEventPropertiesIcon}}}}' )echo "DEBUG: "echo $COMPASS_EVENT_JSON_DATAecho ""COMPASS_EVENT=`curl --request POST \ --url $COMPASS_BASE_URL \ --user $COMPASS_USER_EMAIL:$COMPASS_USER_TOKEN \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --data "$COMPASS_EVENT_JSON_DATA"`echo "COMPASS_EVENT: $COMPASS_EVENT"
response
{ "errors": [ { "type": "CREATE_EVENT_SOURCE_NOT_FOUND", "message": "We could not create the event because the event source is not found. Please check that the external event source ID and the type of event being submitted match the event source.If a Forge App ID was used during event source creation, please also check you are using the same Forge App ID when accessing the event source." } ]}
SOLVED: when creating the event types in GraphQL, the name of X is what should be used and not the ARI of the event
{ "input": { "cloudId": "<your cloud ID>", "externalEventSourceId": "<external event source ID>", "eventType": "CUSTOM" } }
example
COMPASS_CUSTOM_EXTERNAL_EVENT_SOURCE_ID="what ever unique name you give it"
It looks like you're new here. Sign in or register to get started.