Created events not showing up in Activity Feed
Asked by Chase:

I'm trying to use the REST API (and GraphQL API) to create build/deploy events for our components. Right now I'm just manually sending the requests in, but they aren't showing up in the timeline. I've added the event source, attached it, and send the create event request with a successful response, but it's not showing up. Is there any way to see a log of what's going on in Compass so I can try to diagnose this?

Here is my request:

```
{
  "cloudId": "{{COMPASS_CLOUD_ID}}",
  "event": {
    "deployment": {
      "displayName": "deploying",
      "lastUpdated": "2024-03-11T14:50:00Z",
      "updateSequenceNumber": 11,
      "description": "description",
      "url": "https://jenkins.com",
      "externalEventSourceId": "octopus",
      "deploymentProperties": {
        "sequenceNumber": 11,
        "state": "PENDING",
        "pipeline": {
          "pipelineId": "1",
          "url": "https://octopus.com",
          "displayName": "deployment1"
        },
        "environment": {
          "category": "DEVELOPMENT",
          "displayName": "deploy1",
          "environmentId": 1
        }
      }
    }
  }
}
```

One thing that isn't clear is what all the sequence numbers are for and how we use them.


Answers:
author: Vinicius
body: Hi there, Chase!  

First of all apologies for the delayed response! :/  

The call itself is correct, there are a few things to mention here:  

Regarding the "sequence number" you see there: those are used so that the system has an idea of their order (in case multiple come at the same time), so increasing them everytime you make a call will make them show up on your tab.  

The environment: what's really important there is the ID. Usually the ID 1 is the production environment with ID 2 being staging, etc  

And finally, make sure your component has a repository associated with it since the example you used is a deployment with pipelines :)  

Let me know if you have any questions!

comments: author: Chase
body: Hi [@Vinicius](/t5/user/viewprofilepage/user-id/5049137) , sorry I didn't get an email notification regarding your response to this.

Is there a way to know the current sequence number, or which one I should be doing next? Does the sequence number ever reset, like for succeeding builds?

You said my example is a deployment with pipelines - I guess that sounds like what I want, unless I'm mistaken. I'm trying to send build and deploy events from my Jenkins pipelines, is this the right request? I do realize that there's no component ID in the request, but I thought that each event source was tied to a specific component, so it would be inferred.

Also, [according to the docs](https://developer.atlassian.com/cloud/compass/components/send-events-using-rest-api/), \`lastUpdated\` isn't required but when I remove that line I get a 400 back, saying that it must not be null.

Somewhat related - are there any plans for a Jenkins plugin to do this automatically? ?


author: Vinicius
body: Hi there, [@Chase](/t5/user/viewprofilepage/user-id/5445312) !  

Apologies for the delay, was out for a few days and ended up missing the notification for your reply here.  

Without further ado, let's address your questions:  

"Is there a way to know the current sequence number, or which one I should be doing next? Does the sequence number ever reset, like for succeeding builds?"  

Currently, we don't have any way of informing the current number other than getting all the events. Since you're using Jenkins, our suggestion is to pass that as your build number from Jenkins itself as this would be always different and increasing.  

You can refer to this example on how to use Compass API to report Jenkins builds: <https://community.atlassian.com/t5/Compass-questions/Feeding-Jenkins-deploy-data-to-Compass-events/qaq-p/2377594>  

"You said my example is a deployment with pipelines - I guess that sounds like what I want, unless I'm mistaken. I'm trying to send build and deploy events from my Jenkins pipelines, is this the right request? "  

Basically, yes. You can refer to the example I shared above as well, but you got it right.  

"Also, [according to the docs](https://developer.atlassian.com/cloud/compass/components/send-events-using-rest-api/), \`lastUpdated\` isn't required but when I remove that line I get a 400 back, saying that it must not be null."  

Thanks for pointing that out! I've let the team know about this and the doc will be updated accordingly.  

"Somewhat related - are there any plans for a Jenkins plugin to do this automatically?"  

We do have our eyes on that, but no ETAs at the moment so it might take a fair bit to see it show up.  

Let us know if you have any questions!