Outlook webhook notification subscription - api

I already implemented outlook notification rest api into my code and its work fine but today it suddenly failed and gives me 400 error.
Request outlook for create subscription for notification
Output::
{"error":{"code":"ErrorInvalidParameter","message":"The parameter 'Resource' is invalid."}}
My post data as below ::
URL => outlook.office.com/api/v2.0/me/subscriptions
$subscriptionParameters = json_encode(array(
"#odata.type" => "#Microsoft.OutlookServices.PushSubscription",
"Resource" => "https://outlook.office.com/api/v2.0/me/events",
"NotificationURL" => "https://mydomain/acceptnotification.php",
"ChangeType" => "Created, Updated, Deleted",
"ClientState" => "c75831bd-fad3-4191-9a66-280a48528679"
));
Pass above data to outlook with access_token and email address using cUrl
Please suggest me.

Thank you for reporting this issue. Microsoft engineering team is investigating it right now. Meanwhile, a workaround that worked for multiple subscription cases is to use relative URL for the resource property
e.g.
"Resource": "me/events",
Thanks.

Related

User id not coming in get_current_user_id() while running Custom endpoint post request

I am getting this issue while using custom endpoints. My entire functionality is based on get_current_user_id(). So, when I am running endpoint url it's not working through custom endpoint.
Even in init function user id is null. But when I print anything it working fine on site.
I am using this:
register_rest_route('v2', '/product/(?P\d+)/',
array(
'methods' => WP_REST_Server::CREATABLE,
'callback' => 'wp_get_webhook_product',
)
);

"Api execution successful. No data found for the API."

"Api execution successful. No data found for the API."
I am a customer of yodlee using live API .
In /jsonsdk/SiteAccountManagement/getAllSiteAccounts, i am passing both valid cobSessionToken, userSessionToken but it is returning "Api execution successful. No data found for the API." as response.
Shall i know what is wrong in my input.
I am using PHP - REST API.
GET_ALL_SITE_ACCOUNTS = /jsonsdk/SiteAccountManagement/getAllSiteAccounts
$config = array(
"url" => Yodlee\ConfigInc\serviceBaseUrl.Yodlee\ConfigInc\GET_ALL_SITE_ACCOUNTS,
"parameters" => array(
"cobSessionToken" => $cobSessionToken,
"userSessionToken" => $userSessionToken,
)
);
$response_to_request = Yodlee\restClient::Post($config["url"], $config["parameters"]);
so my $response_to_request variable returning "Api execution successful. No data found for the API."
There is nothing wrong with your input. Your user doesn't have any data present in Yodlee's data base and hence this response is returned. You need to first add a site using bank credentials and then you will have data through these APIs.
Please refer to Quick Start guide for more help.

My Salesforce password changed and now my Ruby on Rails app is broken

I have a simple demo app set up to be able to access Salesforce.com from a Ruby on Rails app. My code is extremely simple:
def sign_in_salesforce
client = OAuth2::Client.new(ENV['SALESFORCE_CONSUMER_KEY'], ENV['SALESFORCE_CONSUMER_SECRET'], :site => 'https://login.salesforce.com/', :authorize_url => 'services/oauth2/authorize', :token_url => 'services/oauth2/token')
auth_url = client.auth_code.authorize_url(:redirect_uri => 'https://99.44.242.76:3000/users/oauth_callback')
redirect_to auth_url
end
I then have a method to take care of the callback.
def oauth_callback
db_client = Databasedotcom::Client.new
db_client.authenticate(:token => params[:code])
puts db_client.inspect
end
The error in the console is:
ArgumentError (ArgumentError):
app/controllers/users_controller.rb:60:in `oauth_callback'
The line that is causing the error is:
db_client.authenticate(:token => params[:code])
like the token that I am getting is invalid or something.
It worked fine until I changed my Salesforce password (which they required me to do). What am I missing? Thanks for the help.
If the response you receive is that your refresh token is no longer valid then you need to restart the OAuth process from scratch to obtain a new refresh token; you can then use to get new session tokens in subsequent uses of the app as you have been up until now.
Essentially, start the process as you would for the very first time the app is launched.

Send an email via MailChimp

I think problem is around $api->listSubscribers()
include('../libs/mailchimp/MCAPI.class.php');
$options = array('list_id' => '$list_id', 'subject' => 'Prova', 'from_name' => 'name', 'from_email' => 'info#example.com');
$content = array('html' => '<p>Testo di prova</p>');
$api = new MCAPI($apikey);
$campaignId = $api->campaignCreate('trans', $options, $content);
$api->listSubscribe($options['list_id']);
$api->campaignSendNow($campaignId);
if ($api->errorCode){
echo "Unable to Create New Campaign!";
echo "\n\tCode=".$api->errorCode;
echo "\n\tMsg=".$api->errorMessage."\n";
} else {
echo "New Campaign ID:".$campaignId ."\n";
}
Why does'nt it send an email?
You have a several issues here:
The first one is that you are not doing error checking after each API call. If you take the error checking code from the bottom and stick it after the listSubscribe() call, you'll immediately get an error because you aren't passing any sort of subscriber data (at the very least you need the email address). The docs for listSubscribe are here
Once you do that - unless you've thoroughly read and considered the options in the listSubscribe docs - your second issue is going to be that you are running listSubscribe with the double_optin parameter set to true (the default), which means they won't be subscribed until clicking a link in the confirmation email.
Next, that code is just going to get you in trouble, and probably quickly. If you are going to use psuedo-transcational campaigns it is imperrative that you only create ONE psuedo-trans campaign per type of email and then send that campaign over and over. That's how they are intended to work. Not doing that is going to cause you to fill up your account with a whole bunch of trash campaigns at which point there's no point in using a psuedo-trans campaign since that's the same as creating/sending a regular campaign to a single user over and over.
Do you get any errors?
It seems you are not including the api key, it should look like:
$api = new MCAPI($apikey);
Instead of:
$api = new MCAPI('apikey');
You get the API Key from your api dashboard: http://admin.mailchimp.com/account/api

SugarCRM 5.5.2 Rest api -- login failure

I need to be able to use the API for SugarCRM to exchange information with several other applications. I found the api docs, and some good articles with sample code. The end result of my code is to send this command:
http://localhost/sugarcrm/service/v2/rest.php?method=login&input_type=json&response_type=json&rest_data={%22user_name%22:%22rest%22,%22password%22:%2265e8800b5c6800aad896f888b2a62afc%22,%22version%22:%22.01%22}
Which produces this error
{"name":"Invalid Login","number":10,"description":"Login attempt failed please check the username and password"}null
I have googled the error and found several others with this issue, but no solution.
I think the proper REST string would be like:
method=login&input_type=json&response_type=json&rest_data={"user_auth": {"user_name":"user","password":"somemd5hash","version":"1.0"},"application_name":"RestTest"}
(should be url-encoded then of course)
For me, I needed to use something along the lines of:
method=login&input_type=JSON&response_type=JSON&rest_data=$REST_DATA
The REST data is:
{
user_auth => {
user_name => $USERNAME,
password => $PW,
version => "1.2"
},
application => "foo"
}
(URL encoded)
URL : http://mycrmurl.com/service/v4/rest.php
Request Data - in POST method
method=login&input_type=JSON&response_type=JSON&rest_data={"user_auth":{"user_name":"username","password":"md5password","version":"1.0"},"application_name":"RestTest"}
Response from WS:
{"id":"someID","module_name":"Users","name_value_list":{"user_id":{"name":"user_id","value":"1"},"user_name":{"name":"user_name","value":"username"},"user_language":{"name":"user_language","value":"en_us"},"user_currency_id":{"name":"user_currency_id","value":"-99"},"user_is_admin":{"name":"user_is_admin","value":true},"user_default_team_id":{"name":"user_default_team_id","value":null},"user_default_dateformat":{"name":"user_default_dateformat","value":"m/d/Y"},"user_default_timeformat":{"name":"user_default_timeformat","value":"h:ia"},"user_number_seperator":{"name":"user_number_seperator","value":","},"user_decimal_seperator":{"name":"user_decimal_seperator","value":"."},"mobile_max_list_entries":{"name":"mobile_max_list_entries","value":null},"mobile_max_subpanel_entries":{"name":"mobile_max_subpanel_entries","value":null},"user_currency_name":{"name":"user_currency_name","value":"US Dollars"}}}