1

I want to know if you can retrieve the list of all jobID via a REST or API call, I found nothing in the official doc so does anyone have a trick to get this list? There should be a way, because if you go to Email Studio>Tracking>Sends, there is a recap of everything you sent : enter image description here

2 Answers 2

3

The simplest and fastest way to do this would be to combine a SQL query with your API call.

  1. Create a DE with the corresponding fields to Job View
  2. Query Job View (e.g. SELECT * FROM _Job)
  3. Use the SOAP API using Retrieve on the DataExtensionsObject to get each entry.
    (some samples of doing this from Docs)

You could also set this up as a CSV export or even use it in SSJS or AMPscript if you want.

The Job Dataview provides information on each of the email send jobs coming from SFMC.

0

I've been looking in to this and think it can be accomplished with 2x REST API routes.

STEP 1

First, you **retrieve a collection of send instances:

GET https://{{et_subdomain}}.rest.marketingcloudapis.com/messaging/v1/sends/instance/?$pageSize=50&$page=5&$orderBy=createdDate%20DESC

(note, you might be able to include &$filter= as a query string parameter but I couldn't create a valid filter)

Results:

{
    "sendId": 1047373,
    "customerKey": "C-1047373",
    "sendDefTypeId": 5,
    "categoryId": 35654,
    "name": "J-2179122",
    "memberId": 100003367,
    "enterpriseId": 100003367,
    "modifiedBy": 715549952,
    "modifiedDate": "2023-10-26T22:30:44.5",
    "createdBy": 715549952,
    "createdDate": "2023-10-26T22:30:44.5",
    "splits": [
        {
            "splitId": 2246304,
            "name": "Default Split",
            "sendGroupId": 2358450,
            "jobId": 2179122
        }
    ]
}

This will return an array of all send jobs. Take a good look at all the data returned because there are some nuances between Triggered Sends and normal Scheduled Sends. Specifically, you may note that Triggered Sends may have many jobId's (multiple array items within "splits") since a TS can be updated over the duration of its life.

  • IF sendDefTypeId = 3 THEN "Triggered Send"
  • IF sendDefTypeId = 4 THEN "Scheduled Send"
  • IF sendDefTypeId = 5 THEN "Test Send"

STEP 2

Now that you have extracted the jobID, you make a second API request to retrieve a specific job:

GET https://{{et_subdomain}}.rest.marketingcloudapis.com/messaging/v1/jobs/{{jobID}}

Results:

{
    "id": 2179000,
    "emailId": 137243,
    "status": "Complete",
    "fromName": "myFromName",
    "fromEmail": "[email protected]",
    "sendClassificationId": "08777a77-69a4-e711-a2a3-14a2ec8c9a4d",
    "name": "My Test HTML Email",
    "emailSubject": "Subject Line Goes Here",
    "preHeader": "Preheader text on this line",
    "deliveredTime": "2023-10-26T21:47:00",
    "scheduledTime": "2023-10-26T21:30:00",
    "pickupTime": "2023-10-26T21:31:00",
    "testJobType": "None",
    "hasReadOnlyJobLinks": false,
    "targetLists": [
        {
            "id": 229,
            "objectId": "a8c67104-c372-ee11-b85a-48df77deb2d4",
            "objectType": "CustomObject",
            "name": "All Subscribers",
            "objectName": "My Target Data Extension"
        }
    ],
    "suppressionLists": [
        {
            "objectId": "310a9188-4f65-ea1a-b846-48df87deb1a4",
            "objectType": "ContextualSuppressionList",
            "name": "Global Suppression List"
        },
        {
            "objectId": "2aab98b-d44a-ee11-b85a-48df37deb2d4",
            "objectType": "CustomObject",
            "name": "My Exclusion Data Extension"
        }
    ]
}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .