publish actions to facebook using open graph api and C# - asp.net

I am getting the following error while publishing the facebook action using open graph api,
(Exception - #1611072) The action you're trying to publish is invalid because it does not specify any reference objects. At least one of the following properties must be specified: post.
The actions are properly mapped to object in facebook app dashboard and i also tested the open grap object (my web page) in the debugger and there are no warnings.The meta tags in the page has been set properly.
I am using C# for publishing the actions.
Code follows:
var fb = new FacebookClient("XXX");
var parameters = new Dictionary<string, object>
{
{"og:type", "testnamespace:post"},{"og:url","http://test.sitename.com/postdetails/3247/Hello-ktm"},
{"og:title", "test post"},
{
"og:image",
"http://cdn.test.com/842-ff7c1e64-8d6f-4989-bf77-1a1f1520b39e_th.png"
}
};
var response = fb.Post("me/testnamespace:share", parameters);
Please help.Its urgent.

At least one of the following properties must be specified: post.
Looks like the name of your object you connected the action with is post.
So you will also have to give a parameter named post, containing the URL to your OG object, when publishing the action.

Related

Adding an Event for Espresso on Wordpress from C#

Working with WordPress and the Espresso Plugin for Events. I've never dealt with WP or Plugin's before, so I'm in new territory.
I am attempting to add an event and I keep getting the following error:
{"code":"rest_cannot_create_events","message":"Sorry, you are not allowed to create events. Missing permissions: ee_edit_events,ee_edit_others_events,ee_edit_private_events","data":{"status":403}}
I've gone into the WP admin pages and made sure the user I am trying to login as has all the permissions for this plugin.
The first thing I do is access the /wp-login.php page to get the Cookies:
string formVars = "";
string result = "";
string eventUrl = $"<url>/wp-login.php";
Dictionary<string, string> headers = new Dictionary<string, string>();
formVars = $"log={UserName}&pwd={Password}";
Cookie = new System.Net.CookieContainer();
AllowAutoRedirect = false;
result = PerformPost(eventUrl, formVars, true, headers);
The PerformPost uses an HttpWebRequest to send and receive.
That part seems to work and I get what looks like valid cookies.
I then do another post to /wp-json/ee/v4.8.29/events/ and pass in the body just the name of the event like EVT_name=TestEvent.
It's at this point that I get the the error mentioned above.
So a couple of questions.
1) Has anyone done this before? (Added an Event to Espresso on WordPress)
2) If Espresso doesn't like what I am feeding it, does it generate this error rather than just telling me I'm not giving it the correct information?
I've also tried using the Basic Auth plugin with the same results.
Any help is greatly appreciated.

How to get query parameters value from deep link while dynamic link created using AppInvitation class using Firebase?

In my app, I am sending invitation to people to join my app. I am using AppInvitation IntentBuilder Class to create Intent. After these steps, one URL-link gets generated that we can send to invitees.
I have written below code to generated that link and start the activity to send the link. I am able to send invites and able to successfully launch the app by clicking the dynamiclinks. Both the dynamically and manually created ones.
IDictionary<string, string> values = new Dictionary<string, string>();
values.Add("utm_campaign", "Health");
values.Add("utm_medium", "GoIbibo");
values.Add("ad", "1");
values.Add("credit", "50");
values.Add("utm_source", "Yahoo");
values.Add("afl", "https://www.facebook.com");
var intentbuidl = new AppInviteInvitation.IntentBuilder(MainActivity.mainActivity.GetString(Resource.String.invitation_title))
.SetMessage(MainActivity.mainActivity.GetString(Resource.String.invitation_message))
.SetDeepLink(Android.Net.Uri.Parse(MainActivity.mainActivity.GetString(Resource.String.invitation_deep_link)))
.SetAdditionalReferralParameters(values)
.Build();
MainActivity.mainActivity.StartActivityForResult(Intent.CreateChooser(intentbuidl, "Install"),0);
Generated link: https://aku4q.app.goo.gl/i/619426442529-4a4105fd-33ea-4b0f-bf07-6f4063eef8f8
So my question is, when do invitees open the app using this link? Can we be able to get these additional parameters which I have set using IDictionary from the above generated link?
To my knowledge, no. This is one of the limitations of Firebase deep linking — you can't pass custom parameters and need to use the URL string for everything.
You could check out Branch.io (full disclosure: I'm on the Branch team) for an alternative approach that does allow custom parameters.

Set Apects via REST API Call in Alfresco

What is the JSON Format to set aspects to some folder or documents in alfresco via REST API.
You need to send POST request by the following url (Alfresco 4.1.5):
your_host/alfresco/s/slingshot/doclib/action/aspects/node/workspace/SpacesStore/{nodeUUID}
for Alfresco 5:
your_host/alfresco/s/slingshot/doclib/action/aspects/node/workspace/SpacesStore/{nodeUUID}
with the following body:
{
"added":["abc:doc"],
"removed":[]
}
The preferred approach is to use CMIS rather than the internal slingshot web script. Using CMIS you can add an aspect in a standard way, and you can do it via the browser binding (JSON), the Atom Pub binding (XML), or Web Services.
You can use a CMIS client, such as one of the ones available from http://chemistry.apache.org, or you can do it using the raw binding directly over HTTP.
In CMIS 1.1 you add an aspect by adding its ID to the multi-value property named cmis:secondaryObjectTypeIds.
Here's a gist that shows what this looks like in Java: https://gist.github.com/jpotts/7242070
You need to make one custom webscript.The code of webscript will be like below.In case of webscript you can use below link for learning purpose.
https://wiki.alfresco.com/wiki/Web_Scripts
var props = new Array(1);
props["cm:template"] = document.nodeRef;
document.addAspect("cm:templatable", props);
props = new Array(1);
props["cm:lockIsDeep"] = true;
document.addAspect("cm:lockable", props);
props = new Array(1);
props["cm:hits"] = 1;
document.addAspect("cm:countable", props);

Event System Error with Tridion UI (Experience Manager)

We are publishing extra page using event system on publishing event of pages.
It is working well when we publish a page from the CME. When we create a page using Tridion UI, it is created and published as expected but the event system throws error when it tries to create a target type object.
try
{
foreach (var t in e.Targets)
{
var targets = new List<TargetType>();
some logic
targets.Add(new TargetType(t.Id, page.Session)); // error is in this line
PublishInstructionBase pib = e.PublishTransactions.First().Instruction;
PublishInstruction pi = new PublishInstruction(page.Session);
pi.StartAt = pib.StartAt;
pi.RollbackOnFailure = pib.RollbackOnFailure;
PublishEngine.Publish(
items,
pi,
targets,
PublishPriority.Low
);
}
}
Exception we are getting is InvalidURIException
Both t and Session are not definitely not null which we verified by writing log over there.
Please do suggest what we can to fix the issue?
We manage to fix that by little hack putting code in try catch and creating target type manually if there is exception as we do know Tridion UI publish to staging only initially.
Thanks,
Vikas Kumar
It's hard to tell without exception and stack trace, but I assume you need to read TargetType first and not try to create it, like this:
(TargetType) page.Session.GetObject(t.Id)
It might be that the URIs you use are not from the same Publication context and are therefore invalid.

Drupal node.save and JSONP

I am having an issue with call Drupal node.save using MooTool's JSONP. Here is an example.
Here is my request:
callback Request.JSONP.request_map.request_1
method node.save
sessid 123123123123123
node {"type":"blog","title":"New Title","body":"This is the blog body"}
Here is my result
HTTP/1.0 500 Internal Server Error
I got this working before, but i used AMFPHP and was able to send objects to drupal. I am assuming that this has to do with Drupal expecting an object, but since it is a GET it gets transformed as a string. Is there any way of getting around this with out hacking the code?
Here is my code:
$('newBlogSubmit').addEvent('click', function()
{
var node = {
type : "blog",
title:"New Title",
body :"This is the blog body"
}
var string = JSON.encode(node);
string.escapeRegExp()
var sessID = _sessID;
DrupalService.getInstance().node_save(string, sessID, drupal_handleBlogSubmit);
});
My Drupal Service JS Code:
//NODE
DrupalService.prototype.node_save = function(node, sessid, callback){
var dataObj = {
method : "node.save",
sessid : sessid,
node : node
}
DrupalService.getInstance().request(dataObj, callback);
}
//SEND REQUEST AND CALLBACK FUNCTION
DrupalService.prototype.request = function(dataObject, callback){
new JsonP('http://myDrupalSite.com/services/json', {data: dataObject,onComplete: callback}).request();
}
I am trying to connect the dots, but not too familiar with Drupal, but i would guess all I need to do is turn the string back into an object. Any ideas where I should be looking, or if there is an existing patch?
A first question could be why you use mootools since Drupal comes with jQuery and use it extensively throughout the different modules and Drupal core itself.
Anyways I don't know mootools so can't help you there, but if your request in ending in a internal server error, you have a problem with your drupal code or your js code. So even if I knew exactly what you were doing, I couldn't tell you the problem without looking at the drupal code for your http://myDrupalSite.com/services/json callback.
In general, what you want to make sure is:
You make a POST request, as drupal will cache get's and the semantic of this, is that you are posting data - the node - to the server.
Your data should be sent as post params, this will make them end up in the PHP $_POST variable
Your callback should validate the data and act accordingly, creating a node when the data is intact. You don't need session id's since the script will have the same session the browser has.
I've answered a similar question in detail, which was about altering a field instead of saving a node, but much of the work is still the same. You can take a look on the post, although this is with jQuery and not Mootools.

Resources