Skip to content

Instantly share code, notes, and snippets.

@alChaCC
Last active July 3, 2019 03:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alChaCC/8ea9cb37bcfec1e33d0434ee554aff40 to your computer and use it in GitHub Desktop.
Save alChaCC/8ea9cb37bcfec1e33d0434ee554aff40 to your computer and use it in GitHub Desktop.
Easyship SImple Oauth Integration

Purpose

To Connect your application with Easyship

Authentication

You will need to apply an administrator Easyship API token for your application.

Flows

App -> post to Easyship Registrations endpoint 

    <- return redirect url 
            
    -> redirect user to Easyship Redirect URL
            
    <- After user finish sign up/login, Easyship post user's Easyship API token to callback URL

Endpoints

POST api/v1/hktdc/registrations

Request Body

{
	"user": {
		"first_name": "Jean-Pierre",
		"last_name": "Papin",
		"mobile_phone": "+852 1231 2312",
		"email": "jpp@papin.com"
	},
	"company": {
		"name": "Equipe de Marseille",
		"country_code": "US"
	},
	"store": {
		"id": 1,
		"name": "My store",
		"url": "http://ec2-184-73-7-198.compute-1.amazonaws.com"
	},
  "callback_url": "http://ec2-184-73-7-198.compute-1.amazonaws.com/callback"
}

Response body

{
	"redirect_url": "xxx"
}

POST to your callback url

{
  "token": xxxxxx,
  "store_id": your store id
}

Errors

We also expect error responses in case something fails on our requests.

Errors response

{
  "status": "failed/partial_success",
  "error_type": "xxx",
  "error_message": "xxx"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment