Quantcast
Channel: Opinion: Shopify Community - Shopify APIs & SDKs
Viewing all articles
Browse latest Browse all 25503

Programmatic fulfillment of orders, 400 Error by Gonzalo Recio

$
0
0

Hi guys!

I'm trying to accomplish this: Programatic fulfillment of orders in my Ruby on Rails backend

How am I doing it:

- Created a new Shopify's App and got my API keys
- I'm using Mechanize lib to accomplish that - http://mechanize.rubyforge.org/

- Code being used:

begin
    require 'mechanize'

    @browser = Mechanize.new

    @browser.auth('XXX', 'XXX')

    @payload = {
        "fulfillment" => {
            "notify_customer" => true,
            "tracking_number" => Time.now.to_i.to_s
        }
    }

    @browser.post("https://buy-fifa-ultimate-team-coins.myshopify.com/admin/orders/#{self.order_id}/fulfillments.json", @payload)
rescue Exception => e
    Delayed::Worker.logger.debug e.message
    Delayed::Worker.logger.debug e.backtrace.inspect
end

Error being logged:

Mechanize::ResponseCodeError: 400 => Net::HTTPBadRequest for https://buy-fifa-ultimate-team-coins.myshopify.com/admin/orders/235914041/fulfillments.json -- unhandled response

Need help figuring out what is causing the 400 response! =)

 

Thanks to all


Viewing all articles
Browse latest Browse all 25503

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>