• Resolved dssunil

    (@dssunil)


    Hi

    We are facing an issue while connecting DHL-eCommerce to WooCommerce using rest API. The details we are using are correct

    but facing an error; however, it was working fine on our staging server.

    Error: Unsuccessful – {“code”:”woocommerce_rest_cannot_view”,”message”:”Sorry, you cannot list resources.”,”data”:{“status”:401}}

    please look into this on priority and get it resolved

Viewing 9 replies - 1 through 9 (of 9 total)
  • Hi there @dssunil ??

    We are facing an issue while connecting DHL-eCommerce to WooCommerce using rest API. The details we are using are correct

    but facing an error; however, it was working fine on our staging server.

    Thanks for reaching out, let’s figure out why things are not lining up!

    I understand that the issue was not there while on the staging server, but it started appearing while on production.

    Any differences between the two setups, server-wise or otherwise? Furthermore, any other updates that took place meanwhile, perhaps?

    Moving the production site to staging, instead, shows that the issue is ongoing or stops happening again?

    Additionally, in order to investigate things further, could you please share a copy of your site’s System Status? You can find it via WooCommerce > Status. Select Get system report and then click the Copy for support button.?You can either paste it in your response here, or use https://pastebin.com/ for pasting it there and sharing it with us.

    Also, could you please navigate to WooCommerce > Status > Logs and from the dropdown on the right side, please see if there are any logs starting with the words fatal-error.

    If so, please select View and copy and paste them into your reply here.

    Looking forward to hearing from you!

    Thread Starter dssunil

    (@dssunil)

    Hi Pepe,
    Please find the below system report.

    
    ### WordPress Environment ###
    
    WC Version: 7.1.0
    REST API Version: ? 7.1.0
    WC Blocks Version: ? 8.7.5
    Action Scheduler Version: ? 3.5.2
    Log Directory Writable: ?
    WP Version: 6.1.1
    WP Multisite: –
    WP Memory Limit: 4 GB
    WP Debug Mode: –
    WP Cron: ?
    Language: en_US
    External object cache: –
    
    ### Server Environment ###
    
    Server Info: Apache
    PHP Version: 7.4.33
    PHP Post Max Size: 1 GB
    PHP Time Limit: 30000
    PHP Max Input Vars: 1000
    cURL Version: 7.86.0
    OpenSSL/1.1.1s
    
    SUHOSIN Installed: –
    MySQL Version: 5.7.40
    Max Upload Size: 1 GB
    Default Timezone is UTC: ?
    fsockopen/cURL: ?
    SoapClient: ?
    DOMDocument: ?
    GZip: ?
    Multibyte String: ?
    Remote Post: ?
    Remote Get: ?
    
    ### Database ###
    
    WC Database Version: 6.5.1
    WC Database Prefix: wp_
    Total Database Size: 70.81MB
    Database Data Size: 47.05MB
    Database Index Size: 23.76MB
    wp_woocommerce_sessions: Data: 0.17MB + Index: 0.02MB + Engine InnoDB
    wp_woocommerce_api_keys: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_woocommerce_attribute_taxonomies: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_woocommerce_downloadable_product_permissions: Data: 0.02MB + Index: 0.06MB + Engine InnoDB
    wp_woocommerce_order_items: Data: 0.33MB + Index: 0.11MB + Engine InnoDB
    wp_woocommerce_order_itemmeta: Data: 2.52MB + Index: 3.03MB + Engine InnoDB
    wp_woocommerce_tax_rates: Data: 0.02MB + Index: 0.06MB + Engine InnoDB
    wp_woocommerce_tax_rate_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_woocommerce_shipping_zones: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_woocommerce_shipping_zone_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_woocommerce_shipping_zone_methods: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_woocommerce_payment_tokens: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_woocommerce_payment_tokenmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_woocommerce_log: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_actionscheduler_actions: Data: 1.02MB + Index: 0.98MB + Engine InnoDB
    wp_actionscheduler_claims: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_actionscheduler_groups: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_actionscheduler_logs: Data: 1.52MB + Index: 0.36MB + Engine InnoDB
    wp_commentmeta: Data: 0.19MB + Index: 0.22MB + Engine InnoDB
    wp_comments: Data: 1.52MB + Index: 0.89MB + Engine InnoDB
    wp_gglcptch_allowlist: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_links: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_mailchimp_carts: Data: 0.14MB + Index: 0.00MB + Engine InnoDB
    wp_mailchimp_jobs: Data: 1.50MB + Index: 0.00MB + Engine InnoDB
    wp_options: Data: 5.11MB + Index: 1.06MB + Engine InnoDB
    wp_postmeta: Data: 5.52MB + Index: 7.03MB + Engine InnoDB
    wp_posts: Data: 2.48MB + Index: 0.48MB + Engine InnoDB
    wp_randomnumber: Data: 14.52MB + Index: 0.00MB + Engine InnoDB
    wp_termmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_terms: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_term_relationships: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_term_taxonomy: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_tm_taskmeta: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_tm_tasks: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_usermeta: Data: 5.52MB + Index: 7.03MB + Engine InnoDB
    wp_users: Data: 1.52MB + Index: 0.42MB + Engine InnoDB
    wp_wcpdf_invoice_number: Data: 0.02MB + Index: 0.02MB + Engine MyISAM
    wp_wc_admin_notes: Data: 0.06MB + Index: 0.00MB + Engine InnoDB
    wp_wc_admin_note_actions: Data: 0.05MB + Index: 0.02MB + Engine InnoDB
    wp_wc_category_lookup: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_wc_customer_lookup: Data: 1.52MB + Index: 0.23MB + Engine InnoDB
    wp_wc_download_log: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_wc_order_coupon_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_wc_order_product_lookup: Data: 0.31MB + Index: 0.34MB + Engine InnoDB
    wp_wc_order_stats: Data: 0.22MB + Index: 0.23MB + Engine InnoDB
    wp_wc_order_tax_lookup: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_wc_product_attributes_lookup: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_wc_product_download_directories: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_wc_product_meta_lookup: Data: 0.02MB + Index: 0.09MB + Engine InnoDB
    wp_wc_rate_limits: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_wc_reserved_stock: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
    wp_wc_tax_rate_classes: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_wc_webhooks: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_wpmailsmtp_debug_events: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_wpmailsmtp_tasks_meta: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_wt_iew_action_history: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_wt_iew_cron: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_wt_iew_ftp: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_wt_iew_mapping_template: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    wp_yoast_indexable: Data: 0.45MB + Index: 0.34MB + Engine InnoDB
    wp_yoast_indexable_hierarchy: Data: 0.02MB + Index: 0.05MB + Engine InnoDB
    wp_yoast_migrations: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
    wp_yoast_primary_term: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_yoast_seo_links: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
    wp_yoast_seo_meta: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
    
    ### Post Type Counts ###
    
    acf-field: 7
    acf-field-group: 4
    attachment: 303
    authorised_stockist: 76
    custom_css: 1
    nav_menu_item: 20
    page: 18
    post: 1
    product: 16
    product_variation: 44
    revision: 52
    shop_coupon: 1
    shop_order: 3003
    stockists: 5
    testimonial: 7
    university_team: 5
    wpcf7_contact_form: 1
    
    ### Security ###
    
    Secure connection (HTTPS): ?
    Hide errors from visitors: ?
    
    ### Active Plugins (20) ###
    
    Advanced Custom Fields: by WP Engine – 6.0.5
    Advanced Woocommerce Product Gallery Slider: by UnikInfotech – 1.0.0
    Breadcrumb NavXT: by John Havlik – 7.1.0
    Classic Editor: by WordPress Contributors – 1.6.2
    Contact Form 7: by Takayuki Miyoshi – 5.6.4
    Custom Post Type UI: by WebDevStudios – 1.13.1
    WebToffee PayPal Express Checkout Payment Gateway for WooCommerce ( Free ): by WebToffee – 1.7.6
    reCaptcha by BestWebSoft: by BestWebSoft – 1.68
    Mailchimp for WooCommerce: by Mailchimp – 2.7.6
    OG — Better Share on Social Media: by Marcin Pietrzak – 3.1.9
    CSV Upload: by Dotsquares – 1.1
    WooCommerce Royal Mail Shipping Calculator: by WPRuby – 1.7.8
    Online Worldpay For WooCommerce: by Payment Plugins
    [email protected] – 2.0.6
    
    ShareIt! Social Buttons: by DefThemes – 1.8.7
    WooCommerce PayPal Checkout Gateway: by WooCommerce – 2.1.3
    WooCommerce PayPal Payments: by WooCommerce – 2.0.0
    PDF Invoices & Packing Slips for WooCommerce: by WP Overnight – 3.2.5
    WooCommerce: by Automattic – 7.1.0
    Yoast SEO: by Team Yoast – 19.10
    WPS Hide Login: by WPServeur
    NicolasKulka
    wpformation – 1.9.6
    
    ### Inactive Plugins (3) ###
    
    Converter for Media: by Image Optimization Team by matt plugins – 5.5.0
    WP-Optimize - Clean, Compress, Cache: by David Anderson
    Ruhani Rabin
    Team Updraft – 3.2.9
    
    WPS Limit Login: by WPServeur
    NicolasKulka
    wpformation – 1.5.6
    
    ### Dropin Plugins (2) ###
    
    advanced-cache.php: advanced-cache.php
    maintenance.php: maintenance.php
    
    ### Settings ###
    
    API Enabled: –
    Force SSL: –
    Currency: GBP (£)
    Currency Position: left
    Thousand Separator: ,
    Decimal Separator: .
    Number of Decimals: 2
    Taxonomies: Product Types: external (external)
    grouped (grouped)
    simple (simple)
    variable (variable)
    
    Taxonomies: Product Visibility: exclude-from-catalog (exclude-from-catalog)
    exclude-from-search (exclude-from-search)
    featured (featured)
    outofstock (outofstock)
    rated-1 (rated-1)
    rated-2 (rated-2)
    rated-3 (rated-3)
    rated-4 (rated-4)
    rated-5 (rated-5)
    
    Connected to WooCommerce.com: –
    Enforce Approved Product Download Directories: –
    
    ### WC Pages ###
    
    Shop base: #6 - /shop/
    Cart: #7 - /cart/
    Checkout: #8 - /checkout/
    My account: #9 - /my-account/
    Terms and conditions: ? Page not set
    
    ### Theme ###
    
    Name: themesname
    Version: 1.0
    Author URL: #
    Child Theme: ? – If you are modifying WooCommerce on a parent theme that you did not build personally we recommend using a child theme. See: How to create a child theme
    WooCommerce Support: ? Not declared
    
    ### Templates ###
    
    Overrides: themesname/woocommerce/archive-product.php
    themesname/woocommerce/checkout/form-checkout.php
    themesname/woocommerce/checkout/form-coupon.php version 3.4.4 is out of date. The core version is 7.0.1
    themesname/woocommerce/checkout/form-login.php
    themesname/woocommerce/checkout/thankyou.php
    themesname/woocommerce/content-product.php
    themesname/woocommerce/emails/customer-new-account.php version 3.7.0 is out of date. The core version is 6.0.0
    themesname/woocommerce/myaccount/form-login.php version 4.1.0 is out of date. The core version is 7.0.1
    themesname/woocommerce/myaccount/form-lost-password.php version 3.5.2 is out of date. The core version is 7.0.1
    themesname/woocommerce/myaccount/form-reset-password.php version 3.5.5 is out of date. The core version is 7.0.1
    themesname/woocommerce/single-product/short-description.php
    
    Outdated Templates: ?
    					
    					
    						Learn how to update
    
    ### WooCommerce PayPal Payments ###
    
    Onboarded: ?
    Shop country code: GB
    WooCommerce currency supported: ?
    Advanced Card Processing available in country: ?
    Pay Later messaging available in country: ?
    Webhook status: ?
    Vault enabled: –
    Logging enabled: –
    Reference Transactions: –
    Used PayPal Checkout plugin: ?
    Tracking enabled: –
    
    ### Admin ###
    
    Enabled Features: activity-panels
    analytics
    coupons
    customer-effort-score-tracks
    experimental-products-task
    experimental-import-products-task
    experimental-fashion-sample-products
    shipping-smart-defaults
    shipping-setting-tour
    homescreen
    marketing
    multichannel-marketing
    mobile-app-banner
    navigation
    onboarding
    onboarding-tasks
    remote-inbox-notifications
    remote-free-extensions
    payment-gateway-suggestions
    shipping-label-banner
    subscriptions
    store-alerts
    transient-notices
    woo-mobile-welcome
    wc-pay-promotion
    wc-pay-welcome-page
    
    Disabled Features: minified-js
    new-product-management-experience
    settings
    
    Daily Cron: ? Next scheduled: 2022-12-05 09:18:53 +00:00
    Options: ?
    Notes: 111
    Onboarding: completed
    
    ### Action Scheduler ###
    
    Canceled: 9
    Oldest: 2022-11-08 18:45:42 +0000
    Newest: 2022-12-04 17:52:34 +0000
    
    Complete: 918
    Oldest: 2022-11-04 10:21:39 +0000
    Newest: 2022-12-05 07:12:37 +0000
    
    Failed: 1
    Oldest: 2022-06-06 07:11:50 +0000
    Newest: 2022-06-06 07:11:50 +0000
    
    Pending: 1
    Oldest: 2022-12-05 11:36:49 +0000
    Newest: 2022-12-05 11:36:49 +0000
    
    ### Status report information ###
    
    Generated at: 2022-12-05 07:12:52 +00:00
    
    Saif

    (@babylon1999)

    Hello @dssunil,

    Just to make sure I understand the problem, you’re having a problem with connecting to DHL using WooCommerce rest API.

    The 401error is for unauthorised requests, so the first step is to check if you’ve set up the API key and its permissions correctly. You can learn more about this here.

    If you have a certain API call that’s not working, you can share it with us here and we’ll help troubleshoot the problem. That said, please note custom solution requests like integrating with a third-party service is not within our scope of support.

    Furthermore, checking your system status report I can see your WooCommerce database is not updated. Your site is also running outdated templates, I will leave guides on how to fix both problems below.

    https://woocommerce.com/document/fix-outdated-templates-woocommerce/

    https://woocommerce.com/document/how-to-update-woocommerce/#woocommerce-data-update-notice

    Let us know if you’re still having a problem with WooCommerce API.

    Thread Starter dssunil

    (@dssunil)

    Hi Saif,

    I have give permissions “Read/Write” also I have updated the latest version WooCommerce and upgrade the database.

    But same error given:

    Unsuccessful – {“code”:”woocommerce_rest_cannot_view”,”message”:”Sorry, you cannot list resources.”,”data”:{“status”:401}}

    Kindly, please look into this on priority and get it resolved.

    Saif

    (@babylon1999)

    Hello @dssunil,

    If you’re certain that everything is set up correctly, then you might have a theme or plugin conflict.

    ?
    The best way to determine this is to:

    • Temporarily switch your theme to Storefront
    • Disable all plugins except for WooCommerce
    • Repeat the action that is causing the problem

    If you’re not seeing the same problem after completing the conflict test, then you know the problem was with the plugins and/or theme you deactivated. To figure out which plugin is causing the problem, reactivate your other plugins one by one, testing after each, until you find the one causing conflict. You can find a more detailed explanation on how to do a conflict test here.

    Let us know how it goes!

    Thread Starter dssunil

    (@dssunil)

    Hi Saif,

    I have worked on these point below:

    Temporarily switch your theme to Storefront
    Disable all plugins except for WooCommerce
    Repeat the action that is causing the problem

    But same error given:

    Unsuccessful – {“code”:”woocommerce_rest_cannot_view”,”message”:”Sorry, you cannot list resources.”,”data”:{“status”:401}}

    Kindly, please look into this on priority and get it resolved.

    Howdy @dssunil

    same error given:

    Unsuccessful – {“code”:”woocommerce_rest_cannot_view”,”message”:”Sorry, you cannot list resources.”,”data”:{“status”:401}}

    A picture is worth a thousand words, as the saying goes, therefore, could you also share a screenshot of the screen where the error appears, please? https://snipboard.io/ is a good (online) tool of choice for sharing it here.

    Furthermore, I am investigating the site’s System Status Report (SSR) and I cannot find a plugin referencing DHL. How is that API connection implemented?

    We will be standing by for your response.

    Thread Starter dssunil

    (@dssunil)

    Hi Pepe,
    I Hope you had a great weekend!

    Thank you for your response, Please find the following screenshot of DHL Plugin and and Configuration.

    Configuration: API KEY DELETED, NEVER SHARE THAT EVER

    Error: https://snipboard.io/SeBco3.jpg

    Looking forward to hearing from you asap.

    Thank you.

    • This reply was modified 1 year, 11 months ago by Jan Dembowski.
    Saif

    (@babylon1999)

    Hello @dssunil,

    Your API key is like a password, you should never share it in a public forum.

    Please revoke the key in the screenshot attached as fast as possible, anyone can use it to add/delete products or do whatever they want to your site.

    Here’s where you can find your API keys:


    Link to image: https://d.pr/i/l2RIam

    As for the DHL integration, then as mentioned before integrating third-party services is not within our scope of support here. We can only help if the WooCommerce API itself is not working.

    To test this, please try any API call you find here: https://woocommerce.github.io/woocommerce-rest-api-docs/

    Feel free to use any framework you like, if you still get an error with any of the calls in the link above then please share it with us.

    You can also check the following troubleshooting guide by DHL or contact them directly: https://support.dhlexpresscommerce.com/hc/en-gb/articles/360036286291-Troubleshoot-WooCommerce


    Cheers!

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘DHL Ecommerce rest api threw connect’ is closed to new replies.