Creating new post in Wordpress via REST API - how to past meta title and description for Yoast SEO plugin? - wordpress-rest-api

I'm creating new post using wordpress rest api. On the WP side, there is Yoast SEO plugin used, where I would need to update meta description and meta title fields through API calls. Is there any way how to send this data?

You can use this wp plug-in : https://github.com/ChazUK/wp-api-yoast-meta
{
id: 123,
...
yoast_meta: {
yoast_wpseo_title: "Testy Test | My WordPress site",
yoast_wpseo_metadesc: "My description",
yoast_wpseo_canonical: "http://my-wordpress-site.test/testy-test"
}

Related

Post an article to company LinkedIN page via REST api (v2)

Using v2 of LinkedIn REST API I'm searching for a way to post an article to my company's LinkedIn page.
I've signed up here https://business.linkedin.com/marketing-solutions/marketing-partners/become-a-partner/marketing-developer-program and currently waiting to be approved.
I want to be able to create a blog post on my company website and when i press 'publish' i want to post that blog post, as an article, to my companys LinkedIn page.
The closest i've been to finding information regarding this topic is https://learn.microsoft.com/en-us/linkedin/marketing/integrations/community-management/shares/articles-api
But this does not disclose any information for posting articles, only retrieving and deleting them
You can share articles to your LinkedIn company feed using content entities (contentlocation and thumbnail). You can also provide a title and description for the article you want to share.
An example of a share with article is as follows:
{
"owner": "urn:li:organization:12345",
"content": {
"contentEntities": [{
"entityLocation": "https://www.example.com/content.html",
"thumbnails": [{
"resolvedUrl": "https://www.example.com/image.jpg"
}]
}],
"description": "content description",
"title": "Test Company Share with Content"
},
"text": {
"text": "This is a share with an article"
}
}
Documentation for this API endpoint can be found here:
https://learn.microsoft.com/en-us/linkedin/marketing/integrations/community-management/shares/share-api#share-content.
Hope it helps!
With the new UGCPost APIs, you should use the Create UGC Posts method (Documentation).
To use the method, after authentication, you will use:
POST https://api.linkedin.com/v2/ugcPosts
with the author as your organization, such as "urn:li:organization:5590506". Also, to do so, you will need the w_organization_social permission with one of the following roles:
ADMINISTRATOR
DIRECT_SPONSORED_CONTENT_POSTER
RECRUITING_POSTER

Redirect to profile page using facebook api

I need to create module for website which display feeds from client.
I had get feed from facebook using graph api of fb. But when i click on the profile name it says profile is not available.
This issue is occuring because facebook has moved to graph api 2 and in this version user is returned on basis on app which is diffrent from actual user id.
So if i need to redirect page from the website. How can i implement this?
Thank you for your time.
You can use the link field of the User object like this:
/me?fields=id,first_name,last_name,link
The result will be similar to the following:
{
"id": "10152055263451244234",
"first_name": "TheFirstName",
"last_name": "TheLastName",
"link": "https://www.facebook.com/app_scoped_user_id/10152055263451244234/"
}
Or, if you already have a app-scoped user_id, you can construct the link manually by
"https://www.facebook.com/app_scoped_user_id/" + {user_id} + "/"

how to post a picture to user group using facebook4j api using facebook groupid

How to post a picture to user group using facebook4j api using facebook groupid.
PostUpdate post = new PostUpdate(new URL("projectUrl")).picture(new URL("projectUrl/waz24.jpg")).name("Facebook4J - A Java library for the Facebook Graph API");
facebook.postGroupFeed(getId, post);
above code not showing image it shows some symbol.
Use this for sharing photo with link and description.
PrivacyParameter privacy = new PrivacyBuilder().setValue(PrivacyType.ALL_FRIENDS).build();
PostUpdate postUpdate = new PostUpdate(new URL("http://facebook4j.org"))
.picture(new URL("http://facebook4j.org/images/hero.png"))
.name("Facebook4J - A Java library for the Facebook Graph API")
.caption("facebook4j.org")
.description("Facebook4J is a Java library for the Facebook Graph API. This library provides the ease of use like Twitter4J. Facebook4J is an unofficial library.")
.privacy(privacy);
String postId = facebook.postFeed(postUpdate);
Thanks..

Tagging friends in a fb.api status update?

Is it possible to tag friends somehow using the Facebook fb.api (JavaScript SDK) call?
By tagging I mean what happens when you use "#" in the regular facebook.com UI.
It is currently not possible to tag a friend in a status update or post via the API.
Not sure if that's what you are asking, but the syntax to tag a friend using Facebook API is #[uid:friend name]. However, it seems like there is a bug at the moment and FB does not support it.
Check the Facebook documentation for more information about this: photos.addTag.
Quote:
Each tag in the list must specify: "x", "y", and either the user id "tag_uid" or free-form "tag_text" identifying the person being tagged. An example of this is the string {"x":"70.0","y":"70.0","tag_text":"some person"}
And read in FB.api on how to use the REST API calls using JavaScript.
Yes, you can use FB.api to tag a friends.
E.g. If you would like to a tag a friend(s) withing a message that you will share on a Fb's wall you have to do following.
1) Get extended permissions ('publish_stream') e.g. you can request it while login to the app FBUser.login({scope: 'publish_stream'});
2) You have to pass a string with the facebook_user_id to a 'tag' key of the api object. e.g.
FB.api('me/feed', 'post', {
message: "my message here",
place: '123456789', // mandatory!!!
tags: "123456, 654321, 147258, 852963", // facebook users ids of your friends
name : "Some text here",
description : "Some text here",
picture: "http://wwww.link.to/the_image"})

Facebook publish to stream and attach link

I'm currently using the Facebook Developer Toolkit to publish to my organization's Facebook page. I'd like to be able to attach a link, but can't quite seem to figure out the syntax. Here's what I'm trying.
ConnectSession fbSession = new ConnectSession(API_KEY, API_SECRET);
Api fbApi = new Api(fbSession);
attachment attach = new attachment();
attach.href = "http://www.google.com";
attach.caption = "Google";
attach.name = "Google";
String post = "Here's a cool new search engine I found!";
fbApi.Stream.Publish(post, attach, null, null, Convert.ToInt64(fanPageId));
Here's what I'm going for:
Don't use that the Facebook Developer Toolkit because it's not being properly supported (personal opinion :P) use the FacebookC#SDK
What you want to post are referred to as 'action_links' and can only be posted using the OLD REST API, not the new graph api (https://api.facebook.com/method/stream.publish)
In order to post it you need to encode the JSON in the form:
action_links: [
{ text: "TITLE", href: "LINK"}
]