ShopifyAPI::Context.setup(
api_key: SHOPIFY_API_KEY,
api_secret_key: SHOPIFY_API_SECRET_KEY,
host: "ecsypno.com",
scope: "read_fulfillments, read_orders, read_customers",
is_embedded: false, # Set to true if you are building an embedded app
api_version: "unstable",
is_private: true, # Set to true if you have an existing private app,
log_level: :debug
)
SESSION = ShopifyAPI::Auth::Session.new(
shop: "ecsypno.com",
access_token: SHOPIFY_ACCESS_TOKEN,
)
client = CLIENT = ShopifyAPI::Clients::Rest::Admin.new(
session: SESSION
)
# Clear all previous Webhooks, we're taking over.
client.get( path: 'webhooks' ).body['webhooks'].each do |hook|
client.delete( path: "webhooks/#{hook['id']}" )
end
response = client.post(
path: 'webhooks',
body: {
"webhook": {
"topic": "order/fulfillment_success",
"address": OWN_URL,
"format": "json"
}
}
)
shopify_api version: unstable
Ruby version: ruby 2.7.7p221
Operating system: Linux xps 6.2.0-39-generic 40~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Nov 16 10:53:04 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
9: from /home/zapotek/workspace/scnr/license-manager/app.rb:46:in `<top (required)>'
8: from .../gems/gems/sorbet-runtime-0.5.11163/lib/types/private/methods/_methods.rb:272:in `block in _on_method_added'
7: from .../gems/gems/sorbet-runtime-0.5.11163/lib/types/private/methods/call_validation.rb:256:in `validate_call'
6: from .../gems/gems/sorbet-runtime-0.5.11163/lib/types/private/methods/call_validation.rb:256:in `bind_call'
5: from .../gems/gems/shopify_api-13.3.1/lib/shopify_api/clients/rest/admin.rb:84:in `post'
4: from .../gems/gems/sorbet-runtime-0.5.11163/lib/types/private/methods/call_validation_2_7.rb:108:in `block in create_validator_method_fast1'
3: from .../gems/gems/sorbet-runtime-0.5.11163/lib/types/private/methods/call_validation_2_7.rb:108:in `bind_call'
2: from .../gems/gems/shopify_api-13.3.1/lib/shopify_api/clients/http_client.rb:56:in `request'
1: from .../usr/lib/ruby/2.7.0/json/common.rb:156:in `parse'
.../usr/lib/ruby/2.7.0/json/common.rb:156:in `parse': 783: unexpected token at 'Bad Request' (JSON::ParserError)
I don't think this is a bug with the API library.
This question is probably better suited in the Shopify Community forums. They may be able to point out what is going wrong with your code.
Issue summary
I'm doing:
shopify_api
version:unstable
ruby 2.7.7p221
Linux xps 6.2.0-39-generic 40~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Nov 16 10:53:04 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
Expected behavior
Register Webook and return JSON response.
Actual behavior
HTML "Bad Request" error.
Steps to reproduce the problem
1. 1. 1.