chitchats/chitchats-api-doc

Add endpoint for querying postage rates

gshaw opened this issue · 39 comments

gshaw commented

It would be useful to have an endpoint where you provide the shipment details and you get back an array of postage rates with amounts so that a program could decide which rate to purchase based on cost.

That would be very useful! Currently working on a Woocommerce Wordpress plugin that could retrieve postage rates. Simply sending a POST request, retrieving the price, and then sending a DELETE request. Would love to know if there is a better way to do it.

gshaw commented

I'm hoping that this feature will be scheduled for Q3 (July-Sept), we are starting our planning for this quarter and I'll try to get resources to implement this. Either way I'll update this issue in a couple of weeks with the status of it.

Thanks Gerry. Looking forward to it

@gshaw I was wondering what the status of this is?

gshaw commented

It's on the schedule but lower down for Q3 so it should hopefully land in September. I'll be posting here once I start the work on it.

We are testing a shipping calculator. One idea that I had was exposing a way to return the results as JSON from that. Using this you could get estimates for packages without having to create a shipment.

Using this pattern you would first get an estimate for postage then create a shipment with the specific postage type and hope that rate didn't change :) The chance of that happening would be extremely slim but there is a chance.

The other idea is to allow creating shipments in client accounts and then being able to fetch all the rates for that shipment. Using this way we could guarantee the rate amount when the postage is purchased.

Likely both endpoints will be made available. Do you have a preference? I could probably get the shipping calculator JSON result out a lot faster.

Thanks for getting back to me, I was just following up to see a status, not sure if it fell off or not.

It's hard to say which one is better. Currently I have everything recorded in a DB which is accessed via REST and determines the rate in my new e-com solution (custom).

I dont see the rates changing often (not like I know your business, just guessing), I think it would be beneficial for people like me to be able to quote out rates to my customers. I like both suggestions and hope you can do both but if you cant I would go with getting the rates in real time compared to creating a shipment first to get the rates.

I'm currently looking to use chitchat but this is a big piece for me to switch over as I need to present my customers with accurate rates so I've built out my own solution which I think may cover me for now. I can wait if you think it would be completed in Q3. Also I'm willing to help :)

gshaw commented

It's still on the list, I'll reply here when it goes live. The best help you can give is by trying the APIs out and giving feedback (and using Chit Chats for shipping 😀).

Is this something that might be implemented by end of year? I get probably the Canada Post strike has shifted priorities.

gshaw commented

Yes, it was scheduled as "if possible" but it didn't make it in Q3 round and isn't in consideration for Q4 unfortunately. Wouldn't hurt to send a message via support to lobby for it though. I know it's a hole in the API. The best alternative at this time that I can suggest is making a POST request to the public shipping calculator and scrapping the HTML to get the results. I know this isn't ideal and I feel dirty suggesting it but in a pinch it could work.

I'm also interested in this project as Canada Post is on strike and the USPS Chit Chats Express offers even better pricing that CP. I'm also looking for a temporary alternative that is being suggested. in gshaw post.

Definitely looking forward to seeing functionality to query postages in API!

A must-have feature, for sure!

Per the gshaw's Aug 21 question, would be very helpful for us to have a single request that returns all rates for the shipment. That way we can be sure our app only lists shipping services that are available for the to/from addresses on the shipment.

Thanks for the suggestion to submit request to pricing calculator, my main concern is that output might change and then we will have a broken website. Are you able to add an optional parameter like estimate_view_model[format] = json to receive it in JSON format?

We can consume json no problem! Though if the structure of the json itself changes, we'll need to build a deserializer that can handle it, so would be good to have a heads up. Even something as simple as documentation stating "this field will return type string or string[ ]"

gshaw commented

We considered adding that option but it turns out the pricing could be wrong for some clients so we are holding off until we can make the API return the postage rates as it should. I'm going to to my best to push for this feature soon. I know I've said that before though. Sending a polite request through our support page would help make push it higher up in priority :)

Is the Chit Chat woocommerce plugin ready for use?

Where can i find it?

I'm also interested as to where I can find it?

gshaw commented

For the record, @tremblayly and anybody else, Chit Chats has not released a WooCommerce integration. I'm not sure what @flexrc is offering.

Thank you @gshaw for the clarification. I did look on their website and could not find reference to it.

I'm glad that shipping rates API is finally coming. Is there expected date when it will be in production?

Some people asked me about the WooCommerce plugin, so we've uploaded it here: https://1teamsoftware.com/product/woocommerce-chitchats-shipping/

gshaw commented

@flexrc the API is now available on production for all clients.

@flexrc the API is now available on production for all clients.

Does this mean we can query postages? Any documentation?

gshaw commented

Documentation is in the shipments doc described in this repo. Use unknown for the postage type while passing a ship_date and the result will have results. Pass postage_type to buy a specific postage type.

Documentation is in the shipments doc described in this repo. Use unknown for the postage type while passing a ship_date and the result will have results. Pass postage_type to buy a specific postage type.

I'm trying the following request and it creates shipment, where YYYYY is my Auth token and XXXX is client ID:
curl -X POST
-H "Authorization: YYYYYYYYY"
-H "Content-Type: application/json"
-d '{
"description" : "N/A",
"name": "N/A",
"value": 100,
"address_1": "123 ANYWHERE ST.",
"city": "Vancouver",
"province_code": "BC",
"postal_code": "V6K 1A1",
"country_code": "CA",
"package_type": "parcel",
"postage_type": "unknown",
"size_unit": "cm",
"size_x": 10,
"size_y": 5,
"size_z": 2,
"weight_unit": "g",
"weight": 250,
"ship_date": "today"
}'
"https://chitchats.com/api/v1/clients/XXXXXX/shipments"

@gshaw please advise what might be wrong?

mlywe commented

FYI @gshaw is away on sabbatical.

Issue mentioned above on #3 (comment) is because we implemented auto-select postage for the site UI which would save the shipment if there is only one postage rate available. This affects the API as well which is why the shipment was created as there was only one rate returned, instead of showing the rate.

Issue is tracked but there is no ETA yet for fix.

Just an update on Chit Chats WooCommerce integration plugin:
https://1teamsoftware.com/product/woocommerce-chitchats-shipping/

It allows to have real-time shipping rates in the cart, create shipping labels, track shipments and receive email notifications about the shipment.

@mlywe was wondering if there was a fix for that issue, currently creating any postage_type with a value of unknown is creating a shipment.

I'm assuming in order to get an estimate, it will create the order, once I have the rates I would remove that shipment just for the purpose of getting an estimate

mlywe commented

@sukh-gill No fix yet. Yes currently it would create and save the shipment if there is only one postage returned, instead of listing the estimates.

Any update on this? Seems odd that querying shipping rates creates a shipment. Are we expected to delete the shipment right after? What is the workflow for this?

Thanks for the reply! Any plans to make a query only API for rates?

gshaw commented

@wesbos @oneteamsoftware I can appreciate that it seems odd that you need to create a shipment query rates.

The ideal workflow would be to create the shipment for the order that is in the customer's cart and then show the rates from that shipment. If check out is completed, buy the postage for that shipment, if the cart is abandoned you can delete or ignore the shipment. This way the rate that was shown is guaranteed to be the rate you've shown.

One of the reasons for this is that if you get a rate and display it to the customer but then later create a new shipment and buy the postage there isn't any guarantee that the rates will be the same. Rates don't change often but they do change.

I wish I had the resources to improve the API but at the moment I don't. Good news though, we are hiring developers so if you are interested in working on Chit Chats to improve our API and other features please consider applying.

gshaw commented

I'm going to lock this issue to move this into a discussion.