Public | Automated Build

Last pushed: 8 days ago
Short Description
REST API for Correios WebServices
Full Description

Correios-Adapter

Node.js API express app to enable easier consumption to Correios (Brazil) webservices

Usage

Quick start

Quickly build and run a local server at port 5000

npm build
npm start

Example

# Request
curl -X "POST" "http://localhost:5000" \
     -H "Content-Type: application/json" \
     -d $'{
  "packaging": "box",
  "sourceZip": "80710000",
  "deliveryNotification": false,
  "declaredValue": 2220,
  "destinationZip": "80520340",
  "identifiedRecipient": false,
  "items": [
    {
      "length": 10,
      "weight": 1,
      "height": 10,
      "width": 11
    },
    {
      "length": 11,
      "weight": 1,
      "height": 12,
      "width": 13
    }
  ]
}'

#Answer
[
  {
    "deliveryTime": "1",
    "cost": "51,55",
    "method": "SEDEX Varejo (40010)"
  },
  {
    "deliveryTime": "1",
    "cost": "0,00",
    "method": "SEDEX a Cobrar Varejo (40045)"
  },
  {
    "deliveryTime": "1",
    "cost": "64,48",
    "method": "SEDEX Hoje Varejo (40215)"
  },
  {
    "deliveryTime": "5",
    "cost": "50,15",
    "method": "PAC Varejo (41106)"
  },
  {
    "deliveryTime": "0",
    "cost": "0",
    "method": "Serviço código undefined",
    "error": "Codigo de servico invalido."
  }
]

Tests

npm test
Docker Pull Command
Owner
omnichat
Source Repository

Comments (0)