Giter Club home page Giter Club logo

aws-lambda-apigw-shortenurl-bitlyapi's Introduction

aws-lambda-apigw-shortenurl-bitlyAPI 🐳

Stars Issues Forks Report an issue

overview

reference

medium

API bitly

  • register 1 acc

A) OAuth credential (just refer, NOT in this repo!!!)

  • click Register new app > input App name, App link & Redirect URI bitlysetting
  • access https://bitly.com/oauth/authorize?client_id=<xxx>&redirect_uri=https://www.google.com on browser
  • will auto redirect confirm screen > redirect URI(google.com) with code: OAuth1

OAuth2

B) access token

  • click Generate token > will get access token
  • test POST API:

by CURL

curl \
-H 'Authorization: Bearer xxx' \
-H 'Content-Type: application/json' \
-X POST \
-d '{
  "long_url": "https://github.com/tquangdo/aws-nodejs-post-msg-slack-triggerby-sns",
  "domain": "bit.ly"
}' \
https://api-ssl.bitly.com/v4/shorten
->
{"created_at":"2022-01-15T08:41:16+0000","id":"bit.ly/3fsSWsY","link":"https://bit.ly/3fsSWsY","custom_bitlinks":[],"long_url":"https://github.com/tquangdo/aws-nodejs-post-msg-slack-triggerby-sns","archived":false,"tags":[],"deeplinks":[],"references":{"group":"https://api-ssl.bitly.com/v4/groups/Bm1f8FBF165"}}

by tool

tool

  • test GET API
curl \
-H 'Authorization: Bearer xxx' \
-X GET \
https://api-ssl.bitly.com/v4/bitlinks/bitly.is/3nudTbo
->
{"created_at":"2022-01-15T08:33:31+0000","id":"bitly.is/3nudTbo","link":"https://bitly.is/3nudTbo","custom_bitlinks":[],"long_url":"https://dev.bitly.com/","title":"Introduction | Bitly Developer","archived":false,"created_by":"o_6j3ec0h0v4","client_id":"a5e8cebb233c5d07e5c553e917dffb92fec5264d","tags":[],"deeplinks":[],"references":{"group":"https://api-ssl.bitly.com/v4/groups/Bm1f8FBF165"}}

lambda

  • create DTQLambdaShortenURL
  • test with input
{
  "url": "https://medium.com/velacorpblog/%E1%BB%A9ng-d%E1%BB%A5ng-aws-lambda-aws-api-gateway-v%C3%A0-nodejs-%C4%91%E1%BB%83-t%E1%BA%A1o-m%E1%BB%99t-simple-service-1756a695240b"
}
  • will have result: lambda

api gateway

  • create DTQAPIGWShortenURL apigw1

apigw2

  • deploy API and call POST API with final result (access shorten URL will redirect to https://medium.com/velacorpblog/ứng-dụng-aws-lambda-aws-api-gateway-và-nodejs-để-tạo-một-simple-service-1756a695240b): end

aws-lambda-apigw-shortenurl-bitlyapi's People

Contributors

tquangdo avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.