Skip to content

Instantly share code, notes, and snippets.

@alex-quiterio
Last active October 21, 2022 13:59
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 alex-quiterio/db82d7ee51a80be5c07f8bdbf7a2f514 to your computer and use it in GitHub Desktop.
Save alex-quiterio/db82d7ee51a80be5c07f8bdbf7a2f514 to your computer and use it in GitHub Desktop.

WasteSaver Audit: Create - StreamConfiguration endpoint

  • OLD ENDPOINT: POST /api/store/locations/:org_location_id/streams
  • NEW ENDPOINT: POST /api/store/locations/:org_location_id/waste-stream-configurations

Request payload proposal:

[
  {
    "product": {
      "stream_id": 1,
      "size": 20,
      "container_id": 2
    },
    "quantity": 1,
    "start_date": "2022-10-28",
    "pickup_point_id": "259196f2-287b-4a99-a731-e716398d1eae",
    "container_delivery": true,
    "schedule": {
      "type": "SINGLE | WEEKLY | EVERY_TWO_WEEKS | EVERY_THREE_WEEKS | EVERY_FOUR_WEEKS | EVERY_SIX_WEEKS | EVERY_TWELVE_WEEKS",
      "days": [
        { "day": 3, "time_start": "08:00", "time_end": "18:00" },
        { "day": 5, "time_start": "08:00", "time_end": "18:00" }
      ]
    }
  }
]

Response payload proposal:

{
  "waste_stream_configurations": [
    {
      "id": "8bf886ac-e975-46f5-8289-7aae693f018a",
      "status": "NEW | PENDING | APPROVED | IN_REVIEW",
      "is_cancellable": true,
      "hardware_products_available": true,
      "quantity": 5,
      "size": "20L",
      "schedule": {
        "type": "SINGLE | WEEKLY | EVERY_TWO_WEEKS | EVERY_THREE_WEEKS | EVERY_FOUR_WEEKS | EVERY_SIX_WEEKS | EVERY_TWELVE_WEEKS",
        "days": [
          {
            "day": 5,
            "time_end": "23:59",
            "time_start": "10:50"
          }
        ]
      },
      "waste_stream": {
        "name": { 
          "de-de": "Restmüll",
          "en-gb": "Residual Waste",
          "fr-fr": "Déchets résiduels",
          "nl-nl": "Restafval"
        },
        "image_url": "https://d39t4x71zbx2q8.cloudfront.net/streams/v2/RESTAFVAL.png",
        "background_color": "#625F63",
        "text_color": "#ffffff"
      },
      "pickup_point": {
        "id": "259196f2-287b-4a99-a731-e716398d1eae",
        "name": "Pickup Point",
        "address": {
          "street_name": "Keizersgracht",
          "house_number": "359",
          "postal_code": "1016 EJ",
          "town": "Amsterdam",
          "country_code": "NL",
          "lat": 52.3687078,
          "lon": 4.8849146
        }
      },
      "created_at": "2022-10-19 12:52:46.682394",
      "updated_at": "2022-10-19 12:52:46.682394"
    }
  ]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment