Jump to content

API Reference - Create new deal

POST
https://sandbox.treddy.se/deals/v1/deals
Creates new deal and returns a url where the deal can be managed by the seller on treddy.se

Request


All fields are optional but if you want to make use of the buyer offer flow, we require the seller information to be present upon creation.
Body
{
  "name": "Iphone",
  "description": "Iphone 10 with a small crack on the back",
  "price": 1000,
  "images": [
    "https://treddy.se/images/logo.png"
  ],
  "packageType": "Large",
  "seller": {
    "firstname": "Sven",
    "lastname": "Svensson",
    "phone": "+46701234567",
    "email": "sven.svensson@treddy.se",
    "address": "Akademigränd 3",
    "postcode": "11152",
    "town": "Stockholm"
  }
}
Schema
{
  "name": {
    "type": "string"
  },
  "description": {
    "type": "string"
  },
  "price": {
    "format": "float",
    "type": "number"
  },
  "images": {
    "type": "array",
    "items": {
      "type": "string"
    }
  },
  "packageType": {
    "enum": [
      "Small",
      "Medium",
      "Large",
      "XL"
    ],
    "type": "string"
  },
  "seller": {
    "type": "object",
    "properties": {
      "firstname": {
        "type": "string"
      },
      "lastname": {
        "type": "string"
      },
      "phone": {
        "type": "string"
      },
      "email": {
        "type": "string"
      },
      "address": {
        "type": "string"
      },
      "postcode": {
        "type": "string"
      },
      "town": {
        "type": "string"
      }
    }
  }
}

Response body


{
  "id": "23bd5eb8-ebce-44c6-8eea-7316515b656d",
  "name": "Iphone",
  "description": "Iphone 10 with a small crack on the back",
  "price": 1000,
  "status": "Draft",
  "seller": {
    "firstname": "Sven",
    "lastname": "Svensson",
    "phone": "+46701234567",
    "email": "sven.svensson@treddy.se",
    "address": "Akademigränd 3",
    "postcode": "11152",
    "town": "Stockholm"
  },
  "url": "https://treddy.se/salj-en-vara?dealid=23bd5eb8-ebce-44c6-8eea-7316515b656d"
}
HTTP STATUS CODE SUMMARY
201 - Successful operation
401 - Not Authorized
403 - Not Allowed
405 - Invalid input