Edit

Share via


Create goalsExportJob

Namespace: microsoft.graph

Important

APIs under the /beta version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported. To determine whether an API is available in v1.0, use the Version selector.

Create a new goalsExportJob object in a Viva Goals organization.

This API is available in the following national cloud deployments.

Global service US Government L4 US Government L5 (DOD) China operated by 21Vianet

Permissions

Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.

Permission type Least privileged permissions Higher privileged permissions
Delegated (work or school account) Goals-Export.ReadWrite.All Not available.
Delegated (personal Microsoft account) Not supported. Not supported.
Application Not supported. Not supported.

HTTP request

POST /employeeExperience/goals/exportJobs

Request headers

Name Description
Authorization Bearer {token}. Required. Learn more about authentication and authorization.
Content-type application/json. Required.

Request body

In the request body, supply a JSON representation of the goalsExportJob object.

You can specify the following properties when you create a goalsExportJob object.

Property Type Description
goalsOrganizationId String The unique identifier of the Viva Goals organization.
explorerViewId String The unique identifier of the explorer view to be exported.

You can get the goalsOrganizationId and explorerViewId values from the URL of a Explorer view.

https://goals.microsoft.com/org_uuid/94a356ab-53d5-40e7-8a85-053d6d3b9eb3/objective-explorer?viewId=e5e7a3c1-8cdf-409d-9ce9-ff730d65d95e
  • The org_uuid in the URL, in this example 94a356ab-53d5-40e7-8a85-053d6d3b9eb3, represents the goalsOrganizationId.
  • The viewId in the URL, in this example e5e7a3c1-8cdf-409d-9ce9-ff730d65d95e, represents the explorerViewId.

Response

If successful, this method returns a 201 Created response code and a goalsExportJob object in the response body.

This method also returns 409 Conflict when you attempt to create a goalsExportJob object with the same values (goalsOrganizationId and explorerViewId) as an existing goalsExportJob object that is pending completion.

When the pending job completes, you can create the new goalsExportJob object.

Response headers

Name Description
Location URL to call to check the status of the operation. Required.

Examples

Example 1: Status is notStarted

Request

The following example shows a request.

POST https://graph.microsoft.com/beta/employeeExperience/goals/exportJobs
Content-Type: application/json

{
  "goalsOrganizationId": "String",
  "explorerViewId": "String"
}

Response

The following example shows the response.

Note: The response object shown here might be shortened for readability.

HTTP/1.1 201 Created
Content-Type: application/json
Location: "https://graph.microsoft.com/beta/employeeexperience/goals/exportJobs/j!uJJZyGd87hGFgvZV8bl-GlCBmj39kL1Cl3clung9SgU"

{
  "@odata.type": "#microsoft.graph.goalsExportJob",
  "id": "9eb0bfa0-eaa1-b225-1f83-54ae3e711753",
  "createdDateTime": "String (timestamp)",
  "status": "String"
}

Example 2: Status is conflicting

Request

The following example shows a request.

POST https://graph.microsoft.com/beta/employeeExperience/goals/exportJobs
Content-Type: application/json

{
  "goalsOrganizationId": "String",
  "explorerViewId": "String"
}

Response

The following example shows the response.

Note: The response object shown here might be shortened for readability.

HTTP/1.1 409 Conflict
Content-type: application/json
Location: "https://graph.microsoft.com/beta/employeeexperience/goals/exportJobs/j!uJJZyGd87hGFgvZV8bl-GlCBmj39kL1Cl3clung9SgU"

{
    "error": 
    {
        "code": "notAllowed",
        "message": "Another export job is still active or waiting to be executed",
        "target": "j!uJJZyGd87hGFgvZV8bl-GlCBmj39kL1Cl3clung9SgU",
        "innererror":
        {
            "code": "exportJobAlreadyExists",
            "date": "String (timestamp)",
            "request-id": "String",
            "client-request-id": "String"
        }
    }
}

Example 3: Specified goalsOrganizationId doesn't exist

Request

The following example shows a request.

POST https://graph.microsoft.com/beta/employeeExperience/goals/exportJobs
Content-Type: application/json

{
  "goalsOrganizationId": "String",
  "explorerViewId": "String"
}

Response

The following example shows the response.

Note: The response object shown here might be shortened for readability.

HTTP/1.1 404 Not Found 
Content-type: application/json

{
    "error": {
        "code": "notFound",
        "message": "Goals organization not found",
        "innerError": {
            "code": "goalsOrganizationIdNotFound",
            "date": "String (timestamp)",
            "request-id": "String",
            "client-request-id": "String"
        }
    }
}

Example 4: Invalid goalsOrganizationId is passed

Request

The following example shows a request.

POST https://graph.microsoft.com/beta/employeeExperience/goals/exportJobs
Content-Type: application/json

{
  "goalsOrganizationId": "String",
  "explorerViewId": "String"
}

Response

The following example shows the response.

Note: The response object shown here might be shortened for readability.

HTTP/1.1 400 Bad Request 
Content-type: application/json

{
    "error": {
        "code": "badRequest",
        "message": "'GoalsOrganizationId' must be specified in 'Export Job', and it should be a valid GUID.",
        "innerError": {
            "code": "invalidGoalsOrganizationId",
            "date": "String (timestamp)",
            "request-id": "String",
            "client-request-id": "String"
        }
    }
}