Corey Holmes
Corey Holmes

Reputation: 368

Basic Auth POST request to API with Authorized Headers - Ruby

I'm pretty new to submitting POST requests to API's using API credentials and am looking for an explanation on how it's done in Ruby on Rails.

I'm using the Shipwire API and am trying to POST to /orders.

POST /api/v3/orders HTTP/1.1
Host: api.beta.website.com
Authorization: Basic TG9vayBhdCB0aGF0OyBEdWNrcy4uLm9uIGEgbGFrZSEK

I have an Order object ready but am wondering if anyone could shed some light on this.

Upvotes: 1

Views: 1014

Answers (1)

Md. Farhan Memon
Md. Farhan Memon

Reputation: 6121

Httparty gem will help you make any kind of ReST api requests. You will find lots of tutorials on how to perform basic auth using this gem. However, before jumping on code directly, i would suggest you to understand the request and response on the sandbox mode using the postman plugin for chrome.

Upvotes: 1

Related Questions