coupon_lines doesn't work in woocommerce REST API? - woocommerce

I try to use coupon_lines to create order with woocommerce rest API but doesn't work, I try the following syntax :
coupon_lines: [
[
code: "coupon",
discount: "10"
]
]
Please Help, Thanks in advance

Related

Woocommerce Rest Api: Creating order does not return checkout url

Hi i have Api Developer role in a team.
when i manually click on 'Proceed to checkout' Button & get List of All Oders using Orders Api using Postman i can see checkout url in response in meta_data value
"meta_data": [{
"id": 4450301,
"key": "mailchimp_woocommerce_campaign_id",
"value": ""
},
{
"id": 4450302,
"key": "mailchimp_woocommerce_landing_site",
"value": "https://firewallforce.se/checkout/order-pay/443614/?key=wc_order_o9LVuBKCMnKP6"
}]
But when i create order using create order Api here in docs
https://woocommerce.github.io/woocommerce-rest-api-docs/#create-an-order
instead of clicking checkout button i dont see any checkout url in response.key exists but value empty in meta data. My role is api developer & am not supposed to click manually.i
am stuck for days please help me. thanks in advance

Fetch company posts from linkedin API

I am trying to fetch the posts of the company from the api, I have already applied to the marketing development platform and it was approved. I already got the token with the scope: r_organization_social and I'm calling the /shares api:
https://api.linkedin.com/v2/shares?q=owners&owners=urn:li:organization:{company_ID}&sharesPerOwner=100&count=25&sharesPerOwner=10
But I'm getting the following response:
{
"paging": {
"start": 0,
"count": 25,
"links": [
{
"type": "application/json",
"rel": "next",
"href": "/v2/shares?count=25&owners=urn%3Ali%3Aorganization%3A{company_ID}&q=owners&sharesPerOwner=10&sharesPerOwner=100&start=0"
}
],
"total": 242
},
"elements": []
}
I tried to change the query params and it's still the same
This end-point worked for me:
https://api.linkedin.com/v2/ugcPosts?q=authors&authors=List(urn%3Ali%3Aorganization%3A<ID_ORGANIZATION>)
See documentation: https://learn.microsoft.com/en-us/linkedin/marketing/integrations/community-management/shares/ugc-post-api?tabs=http#sample-request-6
Disclaimer: I've no access to the linkedin API and couldn't test. But these are some things I noticed:
Your url contains two times the paramater sharesPerOwner, try removing one.
In the docs it's recommended to set the sharesPerOwner to 1000 and the count to 50. I'd also include the start paramater, just to make sure:
Maybe try something like this:
GET https://api.linkedin.com/v2/shares?q=owners&owners=urn:li:organization:{id}&sharesPerOwner=1000&count=50&start=0
From the api-docs(https://learn.microsoft.com/en-us/linkedin/marketing/integrations/community-management/shares/share-api?tabs=http#find-shares-by-owner): "Note that the pagination excludes UGC and Direct Sponsored Content (DSC) posts". Make sure that the owner you are testing contains posts.
If this doesn't work. Could you provide some information on how you are sending the request? Have you tried accessing other parts of the api?

Linkedin API - UGCPost Video url is missing

I am using following endpoint to fetch posts
https://api.linkedin.com/v2/ugcPosts?q=authors&authors[0]=urn:li:organization:XXXX&count=100&start=0
"media": [{
"recipes": [
"urn:li:digitalmediaProcessedAsset:(urn:li:digitalmediaAsset:XXXXXXXXXX,urn:li:digitalmediaRecipe:feedshare-video-captions-thumbnails)"
],
"media": "urn:li:digitalmediaAsset:XXXXXXXXXX",
"thumbnails": [],
"status": "READY"
}]
I could see only digitalmedia Asset, But couldn't find original Url like sharable url like
https://dms.licdn.com/playback/C5105AQGCJKQiUe3pmw/8f26be64328644c090703fdc3afd05a8/feedshare-mp4_3300-captions-thumbnails/1507940147251-drlcss?e=1571133600&v=beta&t=RgRX9RM_Z50wt4cwqEHQ79vY6NU-KNcKVPFbEIftqAc
Note : For image, we are getting original Url
https://media.licdn.com/dms/image/C5122AQHvWYVXpP2Few/feedshare-shrink_1280/0?e=1573689600&v=beta&t=gLeLjTO5OlyF-F0RESk9YdSyqMggXLNmkWSUOqldFXw
Using projection helped to solve this issue
https://api.linkedin.com/v2/ugcPosts?q=authors&authors[0]=urn:li:organization:XXXXX&count=100&projection=(paging,elements*(name,localizedName,vanityName,created(actor~(localizedFirstName, localizedLastName)),lastModified(actor~(localizedFirstName, localizedLastName)),specificContent(com.linkedin.ugc.ShareContent(shareMediaCategory,shareCommentary,media(*(media~:playableStreams,originalUrl,description,title))))))
Projection parameter working as of Feb 2020
(paging,elements*(id,created,lastModified,author,specificContent(com.linkedin.ugc.ShareContent(shareMediaCategory,shareCommentary,media(*(media~:playableStreams,originalUrl,description,title))))))

What should the "author" field for a LinkedIn UGC post be for Showcase/Brand pages?

I am trying to specify an author for a UGC post to a showcase page. I am expecting that the author of the showcase post is the showcase page itself, which is what happens when I manually create a post, but this doesn't seem to work with the API.
Let's say I have a showcase urn:li:organizationBrand:123456. If I specify the showcase as the author ("author": "urn:li:organizationBrand:123456) I get an error about an invalid "author" field. But if I wrap the brand URN ID with "organization" instead of "organizationBrand" ("author": "urn:li:organization:123456") it works but I have not found this interchangeability documented anywhere.
This same workaround works for retrieving post stats (/organizationalEntityShareStatistics).
Can anyone explain what the right approach is supposed to be?
Are organization brand URNs meant to effectively be an alias of organization URNs?
You can use the organizationalEntityAcls API to find your URN. organization URNs are not necessarily interchangeable with organizationBrand URNs.
For example:
GET https://api.linkedin.com/v2/organizationalEntityAcls?q=roleAssignee
"paging": {
"count": 10,
"start": 0
},
"elements": [
{
"state": "APPROVED",
"role": "ADMINISTRATOR",
"roleAssignee": "urn:li:person:R8302pZx",
"organizationalTarget": "urn:li:organization:1000"
}
]
}
source: https://learn.microsoft.com/en-us/linkedin/marketing/integrations/community-management/organizations/organization-access-control#find-access-control-information

How tu update a JSON with Ionic and WP-API

I'm using Wordpress as a backend for my Ionic application.
I get all the data I want from my GET request, however I have a "like" system on my website that I would like to implement everytime a user clicks on it, whether he is authenticated or not.
I really don't get how I can update the field based on WP API.
I've set Basic Authentication on my .htaccess, and every time I make a POST request I get rest-cannot-update error.
Here is how the JSON looks like
[
{
"metadata": {
"_edit_lock": [
"1531733011:13"
],
"_edit_last": [
"13"
],
"onesignal_meta_box_present": [
""
],
"onesignal_send_notification": [
""
],
"slider": [
"1"
],
"_post_like_count": [
"2"
],
}
]
Thank you

Resources