Not able to post some fields value using createDraftListing API - php

We have implemented the createDraftListing API using this documentation to create new listing on etsy.
But we are not able to post below field using above API because in documentation request parameter this field are not present.
Also we have added the item weight, item length, item width and item height in request feed and posting this
value to above api call but still showing blank on products.
Product link
Request feed:
{
"title": "ArttoFrames Rustic Custom Picture Poster Frame 1 Wide 1343",
"description": "In a beautiful turqoise, this barnwood frame is the perfect accent to transform a room into a unique decorative space. Hang a few to create an edgy gallery wall or give it to a loved one as a housewarming or baby shower gift. Perfect in a children's room or in an airy living space.",
"quantity": "100",
"state": "active",
"price": 44.55,
"who_made": "collective",
"when_made": "2020_2022",
"listing_type": "physical",
"shipping_profile_id": 165973438594,
"processing_min": 1,
"processing_max": 1,
"item_weight": "0.71",
"item_weight_unit": "lb",
"item_length": 5.5,
"item_width": "7.5",
"item_height": 0.75,
"item_dimensions_unit": "in",
"has_variations": false,
"language": "en-US",
"is_taxable": true,
"should_auto_renew": true,
"is_customizable": true,
"is_personalizable": true,
"personalization_is_required": true,
"personalization_char_count_max": 1,
"personalization_instructions": "",
"taxonomy_id": 2279
}
How to post above fields to etsy?

Related

Not able to post some fields using createDraftListing API

We have implemented the createDraftListing API using this documentation to create new listing on etsy.
But we are not able to post below field using above API because in documentation request parameter this field are not present.
Also we have added the item weight, item length, item width and item height in request feed and posting this value to above api call but still showing blank on products.
Request feed:
{
"title": "this is my title",
"description": "this is my description",
"quantity": "100",
"state": "active",
"price": 44.55,
"who_made": "collective",
"when_made": "2020_2022",
"listing_type": "physical",
"shipping_profile_id": 12345678,
"processing_min": 1,
"processing_max": 1,
"item_weight": "0.71",
"item_weight_unit": "lb",
"item_length": 5.5,
"item_width": "7.5",
"item_height": 0.75,
"item_dimensions_unit": "in",
"has_variations": false,
"language": "en-US",
"is_taxable": true,
"should_auto_renew": true,
"is_customizable": true,
"is_personalizable": true,
"personalization_is_required": true,
"personalization_char_count_max": 1,
"personalization_instructions": "",
"taxonomy_id": 2279
}
So please let us know any api to post above fields to etsy?
Thanks.
first you can get id shipping profile id in get shipping profile api. I try and success

WooCommerce product WPML translation inserted by REST API doesn't include variations of original product

Unfortunately I'm working with wordpress and woocommerce, what I'm trying to accomplish is to insert products and relative translations using the woocommerce REST API, here's the scenario:
First, i create a simple product
{
"name": "Dummy",
"type": "variable",
"attributes": [
{
"id": 2,
"name": "Color",
"position": 1,
"variation": "true",
"options": [
"Bianco",
"Nero"
]
},
{
"id": 3,
"name": "Size",
"position": 2,
"variation": "true",
"options": [
"A",
"B",
"C"
]
}
]
}
This is a variable product, so I need to create its variations as well
The product created return its id, let's say 10
Then I create several product variations like this:
{
"regular_price": "10.10",
"stock_quantity": 10,
"attributes": [
{
"id": 2,
"name": "Color",
"option": "Bianco"
},
{
"id": 3,
"name": "Size",
"option": "A"
}
]
}
So I have a product with variations, now i want to create a translation of the product with wpml, according to wmpl rest api specifications, I create a product translation like this:
{
"name": "Dummy en",
"type": "variable",
"lang": "en",
"translation_of": 10
}
I specified the language en, the main language is it
I included translation_of with the id of the original product
What happens is that the english product is created, but without variations
What I have tried:
Several issues similar to this are solved by the troubleshooting page of wpml, where I can generate missing variations but I need this to be done automatically, products are created automatically, so relative translations too must be
If I enter product page from wordpress back end and I press the update button, variations are created and adjusted, this word for the original product and the variation, but again, I need this to be done automatically
I tried to modify and insert the translation in almost all ways, adding/removing sku, id, attributes, categories ecc.
Any hints? Thanks

Search post by categories Wordpress WP-API

I want to search posts by categories in the WP-API.
I know I can search posts by the attribute categories or filter[cat].
But the posts contains more than one category.
I tried to search like this:
{host}/wp-json/wp/v2/posts?categories=69&filter[cat]=[228,246,237]&per_page=50
or
{host}/wp-json/wp/v2/posts?categories=69&filter[cat]=228&filter[cat]=246&filter[cat]=237&per_page=50
or
{host}/wp-json/wp/v2/posts?categories=69&categories=246&categories=237&categories=228
This didn't work for me. It caused the search to look for the last attribute.
Any ideas?
This is the structure of Json response
{
"id": 9333,
"date": "2016-08-02T14:17:01",
"date_gmt": "2016-08-02T12:17:01",
"guid": {
"rendered": "{post}/?p=9333"
},
"modified": "2016-08-03T08:50:35",
"modified_gmt": "2016-08-03T06:50:35",
"slug": "{post}",
"type": "post",
"link": "{host}/{post}/",
"title": {
"rendered": "{post}"
},
"content": {
"rendered": "{post}"
},
"excerpt": {
"rendered": "{post}"
},
"author": 3,
"featured_media": 0,
"comment_status": "closed",
"ping_status": "closed",
"sticky": false,
"format": "standard",
"categories": [
228,
237,
207,
217,
246,
231,
69,
221,
270,
244
],
"tags": [],
"_links": []
}
Thanks!
If you want to get posts from multiple categories, there are few solutions, depending from your needs.
In case when you want to get posts from category with ID = 1 OR category with ID = 2 use the following URL:
http://localhost/lifelog/wp-json/wp/v2/posts?filter[cat]=1,2
or:
http://localhost/lifelog/wp-json/wp/v2/posts?categories=1,2
For case when you want to get posts from category with ID = 1 AND category with ID = 2 you can use:
http://localhost/lifelog/wp-json/wp/v2/posts?filter[category__and][]=1&filter[category__and][]=2
BUT - some filter values used in the filter array needs authenticated user with edit_posts privileges.
Fortunately, there is a more simple solution - WordPress supports links like:
http://example.com/category/test1+test2/
Under above URL you will get list of posts which are assigned to the test1 AND test2 categories. And in the REST API you can achieve the same behaviour with the following URL:
http://localhost/lifelog/wp-json/wp/v2/posts?filter[category_name]=test1%2Btest2
Please remember that you have to replace the + sign into %2B.

Docusign not displaying tabLabels but names instead

I'm using Docusign's REST API for creating template and sending it to the customer to sign it - everything works fine but the template doesn't display the labels of the tabs (textTabs), there are their names showed only
I'm sending everything in an evelope, an item looks like this:
"textTabs": [
{
"anchorString": "app_contractbundle_contract_masterAgreement_salesforceId",
"anchorUnits": "pixels",
"anchorXOffset": 105,
"anchorYOffset": -3,
"documentId": 1,
"name": "masterAgreement_salesforceId", - this is displayed in the template
"pageNumber": null,
"xPosition": 0,
"yPosition": 0,
"tabLabel": "Salesforce ID", - this should be displayed
"value": null,
"fontSize": null,
"locked": true,
"required": true
},
Thanks!
It's not documented well in the API docs but the name property is what's used for the help tip on tabs, not the tabLabel. Either switch your values or just set the name to the same thing as your tabLabel.

How to merge two JSON Objects into one in php? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
How to merge two json objects into one ? both the json objects have similar structure
I have tried using below code , but its now working
<?php
$requestUrl="http://www.reddit.com/r/deals.json?limit=10&t=hour";
$requestUrl1="http://www.reddit.com/r/redditdeals.json?limit=10&t=hour";
$data=file_get_contents($requestUrl);
$data1=file_get_contents($requestUrl1);
$array1 = json_decode($data);
$array2 = json_decode($data1);
$json = json_encode(array_combine( $array1, $array2 )); //line 8
echo $json;
?>
EDIT : Sorry , Adding error details
Warning: array_combine() expects parameter 1 to be array, object given in "URL" on line 8
null
Edit : Adding JSON Objects $data and $data1 ( to keep it simple i just added only one item for object)
$data = '{
"kind": "Listing",
"data": {
"modhash": "ynp0pgdyf6bd03faef14e60cf6ab97f2e396bb81545ea57578",
"children": [
{
"kind": "t3",
"data": {
"domain": "self.deals",
"banned_by": null,
"media_embed": {
},
"subreddit": "deals",
"selftext_html": "<!-- SC_OFF --><div class=\"md\"><p>Some of you may have seen this already, but CreditSesame is running a promo for the month of November where you refer 6 friends and receive a $150 Amazon Gift Card. I&#39;m hoping we can get a legitimate referral train started so we can all make some easy money. Should come in handy for Christmas shopping.<\/p>\n\n<p>THIS OFFER IS FOR THE US ONLY &amp; YOU HAVE TO BE AT LEAST 18 YEARS OLD.<\/p>\n\n<p>What is CreditSesame?<\/p>\n\n<p>It&#39;s pretty much just like CreditKarma. It shows you your credit score, why you got the score and what you can do to improve it.<\/p>\n\n<p>Most importantly, there is NO CREDIT CARD NEEDED to sign up because it&#39;s FREE. You can of course buy some advanced features, but that&#39;s not necessary.<\/p>\n\n<p>Now, you do have to provide legitimate information, as it uses your SSN to get your credit report. They pull your credit report in a way that won&#39;t hurt your credit score according to their site. (Someone may be able to better explain this than me)<\/p>\n\n<p>Referral Train<\/p>\n\n<p>Here are some basic guidelines to try to get this thing running smoothly: Once you sign up, you can get your referral link by hovering over your name on in the top-right corner and selecting &quot;Invite a friend&quot; from the menu. Paste that link as a reply to who you signed up under in this thread. Each person only needs 6 referrals, so don&#39;t keep signing up under someone when they already have 6 replies. Keep &quot;forking&quot; and spreading the referrals around so that everyone has at least a chance to get a few. Please remove your referral link once you receive 6 referrals so everyone knows you have completed yours. So to get this started, here is my referral link and a non-ref link. If you would like to sign up under me, I would greatly appreciate it.<\/p>\n\n<p><a href=\"http:\/\/csesa.me\/?r=3RQho7mRN\">http:\/\/csesa.me\/?r=3RQho7mRN<\/a> (my link)<\/p>\n\n<p><a href=\"http:\/\/www.creditsesame.com\/\">http:\/\/www.creditsesame.com\/<\/a> (Non-ref)<\/p>\n\n<p>Mods, I have read over the rules and I don&#39;t think I&#39;m breaking any. Please let me know if I am or delete the thread if this is not allowed. Thanks!<\/p>\n<\/div><!-- SC_ON -->",
"selftext": "Some of you may have seen this already, but CreditSesame is running a promo for the month of November where you refer 6 friends and receive a $150 Amazon Gift Card. I'm hoping we can get a legitimate referral train started so we can all make some easy money. Should come in handy for Christmas shopping.\n\nTHIS OFFER IS FOR THE US ONLY &amp; YOU HAVE TO BE AT LEAST 18 YEARS OLD.\n\nWhat is CreditSesame?\n\nIt's pretty much just like CreditKarma. It shows you your credit score, why you got the score and what you can do to improve it.\n\nMost importantly, there is NO CREDIT CARD NEEDED to sign up because it's FREE. You can of course buy some advanced features, but that's not necessary.\n\nNow, you do have to provide legitimate information, as it uses your SSN to get your credit report. They pull your credit report in a way that won't hurt your credit score according to their site. (Someone may be able to better explain this than me)\n\nReferral Train\n\nHere are some basic guidelines to try to get this thing running smoothly: Once you sign up, you can get your referral link by hovering over your name on in the top-right corner and selecting \"Invite a friend\" from the menu. Paste that link as a reply to who you signed up under in this thread. Each person only needs 6 referrals, so don't keep signing up under someone when they already have 6 replies. Keep \"forking\" and spreading the referrals around so that everyone has at least a chance to get a few. Please remove your referral link once you receive 6 referrals so everyone knows you have completed yours. So to get this started, here is my referral link and a non-ref link. If you would like to sign up under me, I would greatly appreciate it.\n\nhttp:\/\/csesa.me\/?r=3RQho7mRN (my link)\n\nhttp:\/\/www.creditsesame.com\/ (Non-ref)\n\nMods, I have read over the rules and I don't think I'm breaking any. Please let me know if I am or delete the thread if this is not allowed. Thanks!",
"likes": null,
"user_reports": [
],
"secure_media": null,
"link_flair_text": null,
"id": "2m366z",
"gilded": 0,
"secure_media_embed": {
},
"clicked": false,
"report_reasons": null,
"author": "EarthBrown",
"media": null,
"score": 5,
"approved_by": null,
"over_18": false,
"hidden": false,
"thumbnail": "self",
"subreddit_id": "t5_2qir9",
"edited": false,
"link_flair_css_class": null,
"author_flair_css_class": null,
"downs": 0,
"mod_reports": [
],
"saved": false,
"is_self": true,
"name": "t3_2m366z",
"permalink": "\/r\/deals\/comments\/2m366z\/free_150_for_6_referrals_to_credit_sesame\/",
"stickied": false,
"created": 1415840944,
"url": "http:\/\/www.reddit.com\/r\/deals\/comments\/2m366z\/free_150_for_6_referrals_to_credit_sesame\/",
"author_flair_text": null,
"title": "Free $150 for 6 Referrals to Credit Sesame!",
"created_utc": 1415812144,
"ups": 5,
"num_comments": 2,
"visited": false,
"num_reports": null,
"distinguished": null
}
}],
"after": "t3_2lx2yh",
"before": null
}
}';
$data1 = '{
"kind": "Listing",
"data": {
"modhash": "mxgmpcysk5ce5f6dbb57adcc895d089f0fc5c98d08361beb37",
"children": [
{
"kind": "t3",
"data": {
"domain": "rodneybrooksjr.com",
"banned_by": null,
"media_embed": {
},
"subreddit": "redditdeals",
"secure_media": null,
"link_flair_text": null,
"id": "2d5ad3",
"gilded": 0,
"secure_media_embed": {
},
"clicked": false,
"report_reasons": null,
"author": "rodneybrooksjr",
"media": null,
"score": 0,
"approved_by": null,
"over_18": false,
"hidden": false,
"thumbnail": "",
"subreddit_id": "t5_2r0ax",
"edited": false,
"link_flair_css_class": null,
"author_flair_css_class": null,
"downs": 0,
"mod_reports": [
],
"saved": false,
"is_self": false,
"name": "t3_2d5ad3",
"permalink": "\/r\/redditdeals\/comments\/2d5ad3\/heres_a_product_i_like_that_you_might_want_to\/",
"stickied": false,
"created": 1407682429,
"url": "http:\/\/rodneybrooksjr.com\/kingston",
"author_flair_text": null,
"title": "Here's a product I like that you might want to check out! You can get Kingston 4GB USB Flash Drive for just $9.97 (a 44% savings!)",
"created_utc": 1407678829,
"ups": 0,
"num_comments": 1,
"visited": false,
"num_reports": null,
"distinguished": null
}
}],
"after": "t3_1zqtxs",
"before": null
}
}';
Am i doing something wrong ? Thanks in advance
Instead of array_combine which combines values in array1 as key and values from array2 as value you should use array_merge($array1, $array2) to merge two arrays

Categories