How to find Api key ID with Event Webhook - sendgrid

We have almost 30 API Keys that we distributed among developers so their apps can send emails through SendGrid. How can I find which API Key has been used for a certain message? I try with an Event Webhook, but nowhere in the resulting json is the API Key.

I checked with the team and they said that the API key is logged, but it is not returned as part of any API response or within the Event Webhook.
However, you can use the Email Activity API to request emails by api_key_id. So if you have your developers’ API key IDs you can find the emails that they have sent.

Related

Does Keycloak API has any endpoint to update account email?

I am trying to change account email in Keycloak, but did not find any useful information in the Keycloak official documentation.
I tried work with this endpoint
PUT /admin/realms/{realm}/users/{id}/execute-actions-email
but it only accepts an array of actions and sends to a user an email to perform specified actions.
But I want to update it directly performing my request. Is this possible?
I think you are looking for below API.
PUT /admin/realms/{realm}/users/{id}
with a JSON payload as below.
{
"email":"new#email.com"
}

Identifying resources of REST endpoints for given context

I am having trouble naming rest endpoints for my otp service.
Here I have 4 endpoints, in brackets I have given inputs
SEND API (Mo. No.) - Generates OTP and send to mobile number, in response it gives TransactionId
RESEND API (TransId) - Resend same OTP to mobile Number with the transactionId
VERIFY API (OTP, TransId)- Verify if the OTP given for the transactionId, is correct to what is stored in cache
ISVERIFIED API (TransId) - Check whether particular transactionId is verified or not
Can anyone please tell me how should I make REST endpoints for these APIs, adhere-ring to REST principles of resources, etc.
I thought of
POST v1/sendOTP
POST v1/resendOTP
POST v1/verifyOTP
POST v1/isVerifiedTransaction
Obviously, this is not a good design of endpoints, I need some help
Better approach would be
POST v1/send-otp
POST v1/resend-otp
POST v1/verify-otp
POST v1/is-verified-transaction if you have to make the separate endpoint for each
else as these can be part of the same end-point only the payload can be different, you cna do something like
POST v1/otp?action=send
POST v1/otp?action=re-send
POST v1/otp?action=verify
POST v1/is-verified-transaction or v1/transaction?status=is-verified
Maybe you should have otp and transaction as resources and do something like this:
POST v1/otp/send
POST v1/transaction/{transId}/resend
GET v1/transaction/{transactionId}/verify?otp={otpId}
GET v1/transaction/{trandId}/isVerified
I am not sure how otp and transactions relate, so it might be a bit off, just throwing the idea of having them as resources

Modify Woocommerce Rest API so it only sends the users content

We are looking at woocommerce Rest API and tried to find any solution to have a restriction on created api for certain user so its only that user tied data that is synced through his api keys.
Ex. User A gets api keys for his user, only products,orders,stock and customer for User A gets synced through his api keys not anything else.
Feels like its just a simple rule that can be added as a function.

Is there a way to maintain context permanently ? such as an API key

I'm using API.AI with a backend in Golang to create a chatbot that queries an API. This API needs a API key.
This API key is user specific, it does not reply the same answer for different users.
I understand that context in API.AI can persist informations but it lasts only for a session.
Is there a way to memorize indefinitely (more or less) an information ?
Thank you all
API.AI doesn't store most dynamic data beyond the session as you've already indicated. For data as secure as API or authentication keys I'd recommend a secure database or datastore outside of API.AI and using user IDs for the platform's your working with through API.AI to connect the user to their API/authentication key (API.AI passes through information about where the request is coming from the originalRequest attribute of the JSON sent with every webhook request).
For instance you can retrieve the ID of a user who accesses your API.AI agent through the Google Assistant with originalRequest.data.user.user_id, Slack users with originalRequest.data.user and Facebook users with originalRequest.data.sender.id

DocuSign resend: This user lacks sufficient permissions to access this resource

I'm attempting to resend an envelope to recipients but get "This user lacks sufficient permissions to access this resource." The envelope was sent by our api user on behalf of another user which is also in the account. So the initial envelope creation would have looked like:
X-DocuSign-Authentication: <n:DocuSignCredentials xmlns:n="http://www.docusign.com/restapi"><IntegratorKey>MY-KEY</IntegratorKey><Password>password</Password><Username>api-user#here.there</Username><SendOnBehalfOf>other.user#somwhere.else</SendOnBehalfOf></n:DocuSignCredentials>
...
That succeeded and I can pull up the envelope audit events via the rest api. However, attempting to resend the envelope using the existing recipients as is as the same api-user results in:
<errorDetails>
<errorCode>USER_LACKS_PERMISSIONS</errorCode>
<message>This user lacks sufficient permissions to access this resource.</message>
</errorDetails>
Any ideas?
It turns out my error was in not specifying the same SendOnBehalfOf user when attempting the resend. Adding that in allows things to work as expected. Same for voiding an envelope and presumably any other envelope altering operation.