Support Forum » User Profile

Forum Replies Created

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • in reply to: Not able to post through REST API #46726
    Michael BergmeisterMichael Bergmeister
    Participant

    Hi Peter,

    any update here?

    thank you

    in reply to: Not able to post through REST API #46488
    Michael BergmeisterMichael Bergmeister
    Participant

    Next problem: I have a relationship field which is not recognized by the WC APIv3.
    And I cannot update that via WP APIv2 as I get a 500 error.

    So what to do now?

    thx

    in reply to: Not able to post through REST API #46472
    Michael BergmeisterMichael Bergmeister
    Participant

    Ok, so I’ll change everything to the WC APIv3 now. Can you please confirm that from your side this is future proof?

    Thank you

    in reply to: Not able to post through REST API #46448
    Michael BergmeisterMichael Bergmeister
    Participant

    With the unchanged code from mb-rest-API plugin it is also working:

    {
    "meta_data": [
    {
    "key": "preis_at",
    "value": "29,90"
    }
    ]
    }

    result:
    "meta_box": {

    "preis_at": "29,90"
    }

    So I really have to change the import structure again?
    I did this already last time, when you advised to updates meta-box CF via WP API v2 …

    in reply to: Not able to post through REST API #46446
    Michael BergmeisterMichael Bergmeister
    Participant

    I tried to update via WC API v3 like this, did not work:

    {
    "meta_box": {
    "relatedlist": [],
    "untertitel": "Der ausagekräftige Untertitel",
    "format": "",
    "einband": "Softcover",
    "illus": "",
    "umfang": "456",
    }
    }

    If I update like this, it does work:
    {
    "meta_data": [
    {
    "key": "umfang",
    "value": "456"
    }
    ]
    }

    This is still with the modified code of your plugIn.
    And it I would need to change the whole import script to adjust to that.

    in reply to: Not able to post through REST API #46444
    Michael BergmeisterMichael Bergmeister
    Participant

    Has there been a change?
    Last time you told me to update the matabox-data through REST API v2, so I’m a bit confused now:
    https://support.metabox.io/topic/getting-fatal-error-on-psoting-updating-posts-via-rest-api/#post-43867

    The workflow is:
    Creating a product with WC API v3
    Updating metabox custom fields with WP API v2

    This was working fine unless the code in your metabox-extension changed.
    After changing the code ($post_id = $post->ID;) there as described it is again working fine.

    I’m just curious if I have to change the code after every update …

    in reply to: Not able to post through REST API #46393
    Michael BergmeisterMichael Bergmeister
    Participant

    The error is thrown when I try to update the metabox-data with wp2 API for a product:

    https://hannl.bw-works.com/wp-json/wp/v2/product/16441

    {
    	"code": "internal_server_error",
    	"message": "<p>Es gab einen kritischen Fehler auf deiner Website.<\/p><p><a href="https:\/\/wordpress.org\/documentation\/article\/faq-troubleshooting\/">Erfahre mehr über die Problembehandlung in WordPress.<\/a><\/p>",
    	"data": {
    		"status": 500,
    		"error": {
    			"type": 1,
    			"message": "Uncaught Error: Call to undefined method WP_Post::get_id() in \/home\/hannl\/public_html\/wp-content\/plugins\/mb-rest-api\/src\/Post.php:9\nStack trace:\n#0 \/home\/hannl\/public_html\/wp-includes\/rest-api\/endpoints\/class-wp-rest-controller.php(474): MetaBox\\RestApi\\Post->update()\n#1 \/home\/hannl\/public_html\/wp-includes\/rest-api\/endpoints\/class-wp-rest-posts-controller.php(939): WP_REST_Controller->update_additional_fields_for_object()\n#2 \/home\/hannl\/public_html\/wp-includes\/rest-api\/class-wp-rest-server.php(1230): WP_REST_Posts_Controller->update_item()\n#3 \/home\/hannl\/public_html\/wp-includes\/rest-api\/class-wp-rest-server.php(1063): WP_REST_Server->respond_to_request()\n#4 \/home\/hannl\/public_html\/wp-includes\/rest-api\/class-wp-rest-server.php(439): WP_REST_Server->dispatch()\n#5 \/home\/hannl\/public_html\/wp-includes\/rest-api.php(420): WP_REST_Server->serve_request()\n#6 \/home\/hannl\/public_html\/wp-includes\/class-wp-hook.php(324): rest_api_loaded()\n#7 \/home\/hannl\/public_html\/wp-includes\/class-wp-hook.php(348): WP_Hook->apply_filters()\n#8 \/home\/hannl\/public_html\/wp-includes\/plugin.php(565): WP_Hook->do_action()\n#9 \/home\/hannl\/public_html\/wp-includes\/class-wp.php(418): do_action_ref_array()\n#10 \/home\/hannl\/public_html\/wp-includes\/class-wp.php(813): WP->parse_request()\n#11 \/home\/hannl\/public_html\/wp-includes\/functions.php(1336): WP->main()\n#12 \/home\/hannl\/public_html\/wp-blog-header.php(16): wp()\n#13 \/home\/hannl\/public_html\/index.php(17): require('...')\n#14 {main}\n  thrown",
    			"file": "\/home\/hannl\/public_html\/wp-content\/plugins\/mb-rest-api\/src\/Post.php",
    			"line": 9
    		}
    	},
    	"additional_errors": []
    }
    in reply to: Not able to post through REST API #46016
    Michael BergmeisterMichael Bergmeister
    Participant

    Here is the error log:

    [18-Jul-2024 00:52:08 UTC] PHP Fatal error: Uncaught Error: Call to undefined method WP_Post::get_id() in /home/hannl/public_html/wp-content/plugins/mb-rest-api/src/Post.php:9
    Stack trace:
    #0 /home/hannl/public_html/wp-includes/rest-api/endpoints/class-wp-rest-controller.php(474): MetaBox\RestApi\Post->update()
    #1 /home/hannl/public_html/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php(939): WP_REST_Controller->update_additional_fields_for_object()
    #2 /home/hannl/public_html/wp-includes/rest-api/class-wp-rest-server.php(1230): WP_REST_Posts_Controller->update_item()
    #3 /home/hannl/public_html/wp-includes/rest-api/class-wp-rest-server.php(1063): WP_REST_Server->respond_to_request()
    #4 /home/hannl/public_html/wp-includes/rest-api/class-wp-rest-server.php(439): WP_REST_Server->dispatch()
    #5 /home/hannl/public_html/wp-includes/rest-api.php(420): WP_REST_Server->serve_request()
    #6 /home/hannl/public_html/wp-includes/class-wp-hook.php(324): rest_api_loaded()
    #7 /home/hannl/public_html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()
    #8 /home/hannl/public_html/wp-includes/plugin.php(565): WP_Hook->do_action()
    #9 /home/hannl/public_html/wp-includes/class-wp.php(418): do_action_ref_array()
    #10 /home/hannl/public_html/wp-includes/class-wp.php(813): WP->parse_request()
    #11 /home/hannl/public_html/wp-includes/functions.php(1336): WP->main()
    #12 /home/hannl/public_html/wp-blog-header.php(16): wp()
    #13 /home/hannl/public_html/index.php(17): require('...')
    #14 {main}
    thrown in /home/hannl/public_html/wp-content/plugins/mb-rest-api/src/Post.php on line 9

    in reply to: Not able to post through REST API #45995
    Michael BergmeisterMichael Bergmeister
    Participant

    Hi Peter,

    No, I just have woo commerce products, nothing else. I’m importing/updating data from a database with a python script to the site, it was working fine, after updating to 2.02 it was not possible to update the products anymore and the error message suggested an error in line 9.

    What I do:
    Getting data and creating a woo simple product through Woo API.
    Creating a post in custom post type "autor" with WordPress API.
    Creating a post in custom post type "translator"with WordPress API..
    Updating metabox fields and relations through WordPress API.

    Running a cronjob and updating new versions of the connected database.

    After removing the code it is running smoothly again.
    I was wondering, as you were updating to make the product update possible, but here it was the opposite result.

    in reply to: Getting Fatal Error on psoting/updating Posts via Rest API #43922
    Michael BergmeisterMichael Bergmeister
    Participant

    Thank you, that was the problem.

    in reply to: Getting Fatal Error on psoting/updating Posts via Rest API #43855
    Michael BergmeisterMichael Bergmeister
    Participant

    I started this project in October last year and I could post/update the woo commerce simple product without any problem. In summer, I got an error 500 but the fields were still filled with the correct data.
    Now, I get the error and the fields don’t contain any value.
    Here is a sample json I send to the Rest API:

    <div> POST https://hannl.bw-works.com/wp-json/wc/v3/products/1477
    "meta_box": {
    		"relatedbook": [],
    		"relatedlist": "",
    		"herobooks": [],
    		"lesetipp": [],
    		"rel_products": [],
    		"untertitel": "Metatesti",
    		"format": "24 x 17",
    		"einband": "Softcover",
    		"illus": "mit zahlreichen Fotos",
    		"umfang": "384",
    		"autor": "Mark Andrews",
    		"autor_2": "Michael Bergmeister",
    		"autor_3": "Andreas Leibetseder",
    		"translator": "Kirsten Borchardt",
    		"translator_2": "",
    		"translator_3": "",
    		"isbn": "9783854457350",
    		"preis_at": "27",
    		"preis_ch": "",
    		"pubdate": "20221121",
    		"zitat": "Unterhält jeden, in dessen Vergangenheit eine Flasche schwarzer Farbe herumlungert",
    		"zitatquelle": "Victoria Segal, Mojo",
    		"zitat_2": "Das Buch gibt einen genauen Einblick, warum Eldritch zu einem der schwierigsten Menschen wurde, mit denen man in der Branche arbeiten kann …",
    		"zitatquelle_2": "on-magazine.co.uk",
    		"zitat_3": "",
    		"zitatquelle_3": "",
    		"ebook": "1",
    		"ebook_isbn": "9783854450000",
    		"ebookpreis": "12",
    		"version": "",
    		"uebersetzter-und-buecher_from": [],
    		"autor-und-buecher_to": [],
    		"3dcover": {
    			"width": 150,
    			"height": 150,
    			"file": "2022\/10\/som3d.jpg",
    			"filesize": 34023,
    			"sizes": {
    				"medium": {
    					"file": "som3d-238x300.jpg",
    					"width": 238,
    					"height": 300,
    					"mime-type": "image\/jpeg",
    					"filesize": 18220,
    					"url": "https:\/\/hannl.bw-works.com\/wp-content\/uploads\/2022\/10\/som3d-238x300.jpg"
    				}
    </div>

    This is the response in Insomnia:

    <div><styletype="text/css">.wp-die-message{
    	display: none;
    }</style><linkrel="stylesheet"href="https://hannl.bw-works.com/wp-content/plugins/query-monitor/assets/query-monitor.css?ver=3.15.0"media="all"/><divdata-qm="qm"><divid="qm-fatal"data-qm-message="Uncaught Error: MetaBox\RestApi\Post::update(): Argument #2 ($post) must be of type WP_Post, WC_Product_Simple given, called in /home/hannl/public_html/wp-includes/rest-api/endpoints/class-wp-rest-controller.php on line 474"data-qm-file="wp-content/plugins/mb-rest-api/src/Post.php"data-qm-line="7"><divclass="qm-fatal-wrap"><p><b>Fatalerror</b>: UncaughtError: MetaBox\RestApi\Post: : update(): Argument#2($post)mustbeoftypeWP_Post,
    WC_Product_Simplegiven,
    calledin/home/hannl/public_html/wp-includes/rest-api/endpoints/class-wp-rest-controller.phponline474<br>in<b>/home/hannl/public_html/wp-content/plugins/mb-rest-api/src/Post.php</b>online<b>7</b></p><p>Callstack: </p><ol><li><code>MetaBox\RestApi\Post: : update()</code><br><spanclass="qm-info qm-supplemental">wp-includes/rest-api/endpoints/class-wp-rest-controller.php: 474</span></li><li><code>WP_REST_Controller: : update_additional_fields_for_object()</code><br><spanclass="qm-info qm-supplemental">wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-crud-controller.php: 245</span></li><li><code>WC_REST_CRUD_Controller: : update_item()</code><br><spanclass="qm-info qm-supplemental">wp-includes/rest-api/class-wp-rest-server.php: 1193</span></li><li><code>WP_REST_Server: : respond_to_request()</code><br><spanclass="qm-info qm-supplemental">wp-includes/rest-api/class-wp-rest-server.php: 1041</span></li><li><code>WP_REST_Server: : dispatch()</code><br><spanclass="qm-info qm-supplemental">wp-includes/rest-api/class-wp-rest-server.php: 431</span></li><li><code>WP_REST_Server: : serve_request()</code><br><spanclass="qm-info qm-supplemental">wp-includes/rest-api.php: 424</span></li><li><code>rest_api_loaded()</code><br><spanclass="qm-info qm-supplemental">wp-includes/class-wp-hook.php: 324</span></li><li><code>WP_Hook: : apply_filters()</code><br><spanclass="qm-info qm-supplemental">wp-includes/class-wp-hook.php: 348</span></li><li><code>WP_Hook: : do_action()</code><br><spanclass="qm-info qm-supplemental">wp-includes/plugin.php: 565</span></li><li><code>do_action_ref_array()</code><br><spanclass="qm-info qm-supplemental">wp-includes/class-wp.php: 418</span></li><li><code>WP: : parse_request()</code><br><spanclass="qm-info qm-supplemental">wp-includes/class-wp.php: 813</span></li><li><code>WP: : main()</code><br><spanclass="qm-info qm-supplemental">wp-includes/functions.php: 1336</span></li><li><code>wp()</code><br><spanclass="qm-info qm-supplemental">wp-blog-header.php: 16</span></li><li><code>require()</code><br><spanclass="qm-info qm-supplemental">index.php: 17</span></li></ol></div><h2>QueryMonitor</h2></div></div>{
    	"code": "internal_server_error",
    	"message": "<p>Es gab einen kritischen Fehler auf deiner Website.<\/p><p><a href="https:\/\/wordpress.org\/documentation\/article\/faq-troubleshooting\/">Erfahre mehr über die Problembehandlung in WordPress.<\/a><\/p>",
    	"data": {
    		"status": 500
    	},
    	"additional_errors": []
    }
    </div>
    in reply to: Getting Fatal Error on psoting/updating Posts via Rest API #43838
    Michael BergmeisterMichael Bergmeister
    Participant

    Hello Peter,

    thank you for clarification.
    But this was working before. Why can't I update my products any more?
    I need MetaBox mostly to add custom fields to products which will be updated by json I get from another database.
    Is there a workaround?

Viewing 12 posts - 1 through 12 (of 12 total)