Butch128
Butch128

Reputation: 49

https://graph.microsoft.com/beta/subscriptions includeResourceData & encryptionCertificate

I need more direction on what the microsoft graph subscriptions API is requiring for me to use the includeResourceData parameter.

If I do not use includeResourceData I am able to subscribe to the webhook events with no issues.

I POST to https://graph.microsoft.com/beta/subscriptions

My JSON payload is as follow:

{"changeType":"created,updated,deleted","encryptionCertificateId":"butchid","encryptionCertificate":"AAAAB3NzaC1yc2EAAAABIwAAAQEA18MJo8YuC7CH2gCiu6G70wWsGqEm2Llu3csF7fVF5aFC+cv6RtCtTAajXKldkXANM9i5kbTl7pWC3qPPJmK2kftMFLcRZznRZlAnhX\/PN+VLI4s5MjLUldlXojmN5kjjAEMiN0g3jL5hDMKDk0H9N93tKRCTMK11EBsJZPXCZjvETiSn663A\/vAEa9txQNQr7cTp\/EwLplQZmqLRcMP2mNdvY6NCMXCTvz3Es8MplOSc3HgGlze\/GP46B+7C0FkTXN+kRlkPwC7rwVjRuGjkPX8gx2jQ\/OqtK4m3U2SXHzgvbi5kIkZbFKSPlgkWGtuDMSlWUaIIU\/p7RyuK54HIiQ==","notificationUrl":"https:\/\/butch-dev-vote.polldev.com\/api\/v1\/microsoft_teams\/recognition\/subscription","resource":"teams\/allMessages","includeResourceData":true,"expirationDateTime":"2020-07-08T21:00:50.000Z","clientState":"secretClientValue","latestSupportedTlsVersion":"v1_2"}

However I get a response of...

[error] => Array
(
    [code] => InvalidRequest
    [message] => Certificate validation error: Cannot find the requested object.

    [innerError] => Array
        (
            [date] => 2020-07-08T20:00:50
            [request-id] => 433c60fe-7aec-4ab5-9534-3af4c69ab6d7
        )

)

If I don't include encryptionCertificateId I get a response of:

[error] => Array
    (
        [code] => InvalidRequest
        [message] => Certificate ID cannot be empty
        [innerError] => Array
            (
                [date] => 2020-07-08T19:56:57
                [request-id] => e50b21e4-ec8c-4589-9602-25b1b1700c96
            )

    )

Can anyone guide me on what the expected encryptionCertificate and encryptionCertificateId should be in order to use includeResourceData?

Upvotes: 0

Views: 458

Answers (1)

baywet
baywet

Reputation: 5372

For reference for other readers, using the following commands to generate the certificate and then base64 encoding the publickey.cer file is what should be used to created a subscription. X.509: Private / Public Key

Upvotes: 1

Related Questions