Subscribe users to notifications via Soft Layer API - api

I have a set of users that I want to subscribe to the same notifications available via the Portal. However, as I'm automating the creation/management of these users, I also want to automate the subscription to these notifications.
I've reviewed the API documentation, searched for any examples/tutorials, and I'm still not having any luck figuring out how to accomplish this.
Any clues, or examples would be awesome.

To add the permission, execute the following request:
https://[username]:[apikey]#api.softlayer.com/rest/v3/SoftLayer_User_Customer/[user_id]/addBulkPortalPermission
Method: POST
Json (payload):
{
"parameters": [
[
{
"keyName": "NTF_SUBSCRIBER_MANAGE"
}
]
]
}
To get the user permissions, execute:
https://[username]:[apikey]#api.softlayer.com/rest/v3/SoftLayer_User_Customer/[ User_Customer_ID]/getPermissions
References:
http://sldn.softlayer.com/reference/services/SoftLayer_User_Customer
EDIT:
Follow these steps to subscribe notifications to a customer user:
Example: Add “PLANNED_MAINTENANCE” notification subscription.
1. Create a notification subscription record for the user using: SoftLayer_User_Customer::addNotificationSubscriber
URL:
https://[username:[apikey]#api.softlayer.com/rest/v3/SoftLayer_User_Customer/[user_customer_id]/addNotificationSubscriber
Method: POST
Json (payload):
{
"parameters": [
" PLANNED_MAINTENANCE"
]
}
Reference:
http://sldn.softlayer.com/reference/services/SoftLayer_User_Customer/addNotificationSubscriber
2. Create delivery methods for a notification that the user is subscribed to (SoftLayer_User_Customer::createSubscriberDeliveryMethods).
URL:
https://[username]:[apikey]#api.softlayer.com/rest/v3/SoftLayer_User_Customer/[user_customer_id]/createSubscriberDeliveryMethods
Method: POST
Json (payload):
{
"parameters": [
"PLANNED_MAINTENANCE",
[
"EMAIL"
]
]
}
To get information about “notificationKeyName” and “deliveryMethodKeyNames”, execute:
https://[username]:[apikey]#api.softlayer.com/rest/v3/SoftLayer_Account/getActiveNotificationSubscribers?objectMask=mask[id, notification, active,deliveryMethods[notificationDeliveryMethod[active,keyName],notificationSubscriber]]
Reference:
http://sldn.softlayer.com/reference/services/SoftLayer_User_Customer/createSubscriberDeliveryMethods

Related

Attempting to subscribe to a Shopify Webhook w/AWS EventBridge produces error: "Address is an AWS ARN and includes api_client_id 'x' instead of 'y'"

I'm running this request through Postman. Some posts to the Shopify developer forum (e.g., this one) express without clear explanation that the request should be made within the Shopify app that would be subscribing to the Webhooks, but Postman seems to work, too.
In Postman . . .
Here's the endpoint:
https://{{shopifyDevelopmentStoreName}}.myshopify.com/admin/api/2022-07/graphql.json
Here's the GraphQL body:
mutation createWebhookSubscription($topic: WebhookSubscriptionTopic!, $webhookSubscription: EventBridgeWebhookSubscriptionInput!) {
eventBridgeWebhookSubscriptionCreate(
topic: $topic,
webhookSubscription: $webhookSubscription
) {
webhookSubscription {
id
}
userErrors {
message
}
}
}
Here's the payload being sent (notice the "client_id_x" value within the arn property):
{
"topic": "PRODUCTS_CREATE",
"webhookSubscription": {
"arn": "arn:aws:events:us-east-1::event-source/aws.partner/shopify.com/client_id_x/LovecraftEventBridgeSource",
"format": "JSON",
"includeFields": "id"
}
}
Here's the response I receive:
{
"data": {
"eventBridgeWebhookSubscriptionCreate": {
"webhookSubscription": null,
"userErrors": [
{
"message": "Address is invalid"
},
{
"message": "Address is an AWS ARN and includes api_client_id 'client_id_x' instead of 'client_id_y'"
}
]
}
},
"extensions": {
"cost": {
"requestedQueryCost": 10,
"actualQueryCost": 10,
"throttleStatus": {
"maximumAvailable": 1000.0,
"currentlyAvailable": 990,
"restoreRate": 50.0
}
}
}
}
What's entirely unclear is why Shopify is insisting upon validity of "client_id_y" when, in AWS, the value being displayed is undeniably 'client_id_x'. Extremely confusing. I don't even see what difference using the Shopify app would make except that it produces a client_id value that works counter to one's expectations and intuitions.
Does anyone know why the heck Shopify isn't just using the client_id value of the event bus created earlier in Amazon EventBridge?
Same happend to me and I was lucky to find a solution.
The error message is just missleading.
I replaced the API Access Token for the Shopify Rest API Request (X-Shopify-Access-Token)
with the one from the Shopify App holding the aws credentials.
admin/settings/apps/development -> app -> API credentials -> Admin API access token. (can only be seen after creation)
Then I could subscribe webhooks to the app via the Rest Interface.

Invalid variant ID while creating checkout for Shopify

I am trying to create checkout url using Admin API with following params.
URL: https://shopy-test11.myshopify.com/admin/api/2020-10/checkouts.json
{
"checkout": {
"line_items": [
{
"variant_id": 37033347711169,"quantity": 2
}
]
}
}
Unfortunately its returning below error which is not properly documented anywhere that I could find.
{
"errors": {
"line_items": {
"0": {
"variant_id": [
{
"code": "invalid",
"message": "is invalid",
"options": {}
}
]
}
}
}
}
I also tried Shopify-api ruby gem and got same error. There are some similar issue online, but none answers why that issue is occurring and how to fix it. This is new app under development which will create custom checkout. There's only one sales channel which is "Online Store" and is enabled for all products. Any ideas how to fix this issue? Any help is appreciated.
You seem to be mixing up concepts here. The checkout API is only associated with the Storefront API, and has nothing to do with the Admin API.
So this URL: /admin/api/2020-10/checkouts.json seems to be impossible. There is no endpoint in the admin API for checkouts, whereas, Storefront API which does have checkouts, might be your proper URL. So try that:
/api/2020-10/checkouts.json
And if you have the correct token in your header, it will likely work.

Empty response when trying retrieve a user's followers

Request (with my actual access token in place of UserAccessToken):
https://api.instagram.com/v1/users/self/follows?access_token=UserAccessToken
Response:
{
"pagination": {},
"data": [],
"meta": { "code": 200 }
}
Sandbox: YES
Invite to user: accepted
Has anyone had this problem? Please help!
beacuse your app in in sanbox mode .
it just show users insert in sanbox mode.(just 3 people can inserted to this mode.)
follow this link to see more deatails :
https://www.instagram.com/developer/sandbox/
if it will be in live mode it will work(need to accept instagram company.).

OAuth linking with actions on google

hello im trying to setup account linking for actions on google. when testing in the simulator there is no debugInfo.sharedDebugInfo info in the response. my question is what am i missing to get this to be populated. ive set the welcome intent to be signedIn via the api.ai console as well as all the other necessary fields for oauth linking.
view of the setting on api.ai console(signin required)
view of the setting on api.ai console(oauth form)
Once you enable the "sign-in required for Welcome intent", you should see it right after you ask the "can i talk to myAgent" question.
Here is what I see:
Request
{
"query": "can i talk to myAgent",
"accessToken": "ya29.GlzXA38i6oBr0UD5CxXzstBaYFpbQF0tL16jK7tefC2_lWvofj79TbCmrDS1jedhxc_-LJp0w6PW3CJN5wL3oOFoqSMAZ8TbAKiMW6SKcUM65DUVdsSWC65nc_Oezg"
}
Response
{
"response": "It looks like your myAgent account is not linked yet. You can link myAgent to your Google Account from the Google Home app.",
"audioResponse": "//NExAASi..."content_copy,
"debugInfo": {
"sharedDebugInfo": [
{
"name": "Account Linking Url",
"debugInfo": "https://assistant.google.com/services/auth/handoffs/auth/start?provider=myAgent-156006_dev&return_url=https://www.google.com/"
}
]
}
}

Can we receive step data in the pub sub payload?

I can see in the payload JSON that the pubsub notification includes the events but is it also capable of sending the activity or sleep amounts (e.g steps or sleep minutes)?
No, the pubsub notification will only include the user and the list of events that took place. You can then use this information to query the APIs that pertain to those specific types of events.
For example, suppose you receive the following pubsub notification:
{
"notification_timestamp": "1372787949",
"events": [
{
"user_xid": "RGaCBFg9CsB83FsEcMY44A",
"event_xid": "EJpCkyAtwoO0XTdkYyuTNw",
"type": "move",
"action": "creation" ,
"timestamp": "1372787849"
},
{
"user_xid": "RGaCBFg9CsB83FsEcMY44A",
"event_xid": "blaHyAtwoO0XTdkYyuTNw",
"type": "sleep",
"action": "updation" ,
"timestamp": "1372787859"
}
],
"secret_hash": "e570b3071a0964f9e2e69d13nd9ba19535392aaa",
}
Then you know that a move event was created and that a sleep event was updated for the user specified by user_xid: RGaCBFg9CsB83FsEcMY44A
Use this user's xid to determine which previously saved access_token to send with your next API requests.
You can get the details for the move event by sending a request to the moves endpoint with the event_xid: EJpCkyAtwoO0XTdkYyuTNw:
GET https://jawbone.com/nudge/api/v.1.1/moves/EJpCkyAtwoO0XTdkYyuTNw
And yo ucan get the details for the sleep event by querying the sleeps endpoint with the event_xid: blaHyAtwoO0XTdkYyuTN:
GET https://jawbone.com/nudge/api/v.1.1/sleeps/blaHyAtwoO0XTdkYyuTN