POST PurchaseContract/PostPurchaseContract

Create a purchase contract

Request Information

URI Parameters

Body Parameters

ClsGrPurConAdd
NameDescriptionTypeAdditional Information
ContractID

ID of the purchase contract

string

Max length: 15

LocationID

ID of the delivery location for the contract

string

Required

Max length: 6

CustomerID

ID of the customer on the contract

string

Required

Max length: 6

CommodityID

ID of the commodity on the contract

string

Required

Max length: 6

DateEstablished

Date the contract was established

string

Required

Format must be MM/dd/yyyy

ContractType

Type of contract

PurchaseContractType

Required

ContractStatus

Current status of the contract

PurchaseContractStatus

Required

CashPrice

Cash price established for the contract

decimal number
ContractQuantity

Contracted quantity of the commodity

decimal number

Required

Cannot be negative

BasisPrice

Difference between the futures price and cash price

decimal number
FuturesMonthID

ID of the futures month used for the futures price

string

Max length: 10

ExchangeID

ID of the exchange used to establish the price

string

Max length: 10

StrikePrice

Price at which a futures contract can be bought or sold

decimal number
ExpireDate

Expiration date of the contract

string

Format must be MM/dd/yyyy

FuturesPrice

Futures price established for the contract

decimal number
ContractSigned

Indicates whether or not the contract has been signed

boolean
BidCriteriaID

ID for the terms of the bid

string

Max length: 20

ShippingDestinationID

ID of the shipping destination to apply to the contract

string

Max length: 6

SalespersonID

ID of the salesperson associated with the contract

string

Max length: 15

PricingNotes

Note related to pricing for the contract

string

Max length: 50

PriceByDate

Date by which the contract should be priced or rolled

string

Format must be MM/dd/yyyy

FreightOnBoard

Indicates whether or not the contract includes freight in the established price

boolean
ExternalContractID

Reference ID from another source to be stored with the contract

string

Max length: 50

ContractFormat

The format used to create the physical contract to sign. NOTE: This is required when the database column exists and no defaults are set in Agvance.

string

Max length: 50

DirectShipped

Flag that indicates if the purchase contract is to be treated as direct shipped

boolean
PurchaseContractComments

List of comments associated with the contract

Collection of ClsGrPurConCommAdd
PurchaseContractDeliveryDates

List of delivery dates for the contract

Collection of ClsGrPurConDdAdd

Request Formats

application/json, text/json

Sample:
{
  "ContractID": "sample string 1",
  "LocationID": "sample string 2",
  "CustomerID": "sample string 3",
  "CommodityID": "sample string 4",
  "DateEstablished": "sample string 5",
  "ContractType": 1,
  "ContractStatus": 1,
  "CashPrice": 6.1,
  "ContractQuantity": 7.1,
  "BasisPrice": 8.1,
  "FuturesMonthID": "sample string 9",
  "ExchangeID": "sample string 10",
  "StrikePrice": 11.1,
  "ExpireDate": "sample string 12",
  "FuturesPrice": 13.1,
  "ContractSigned": true,
  "BidCriteriaID": "sample string 15",
  "ShippingDestinationID": "sample string 16",
  "SalespersonID": "sample string 17",
  "PricingNotes": "sample string 18",
  "PriceByDate": "sample string 19",
  "FreightOnBoard": true,
  "ExternalContractID": "sample string 21",
  "ContractFormat": "sample string 22",
  "DirectShipped": true,
  "PurchaseContractComments": [
    {
      "Comment": "sample string 1"
    },
    {
      "Comment": "sample string 1"
    }
  ],
  "PurchaseContractDeliveryDates": [
    {
      "StartDate": "sample string 1",
      "CompleteDate": "sample string 2",
      "Quantity": 3.1
    },
    {
      "StartDate": "sample string 1",
      "CompleteDate": "sample string 2",
      "Quantity": 3.1
    }
  ]
}

application/xml, text/xml

Sample:
<ClsGrPurCon.ClsGrPurConAdd xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/SKY.Core.Grain">
  <BasisPrice>8.1</BasisPrice>
  <BidCriteriaID>sample string 15</BidCriteriaID>
  <CashPrice>6.1</CashPrice>
  <CommodityID>sample string 4</CommodityID>
  <ContractFormat>sample string 22</ContractFormat>
  <ContractID>sample string 1</ContractID>
  <ContractQuantity>7.1</ContractQuantity>
  <ContractSigned>true</ContractSigned>
  <ContractStatus>Open</ContractStatus>
  <ContractType>Priced</ContractType>
  <CustomerID>sample string 3</CustomerID>
  <DateEstablished>sample string 5</DateEstablished>
  <DirectShipped>true</DirectShipped>
  <ExchangeID>sample string 10</ExchangeID>
  <ExpireDate>sample string 12</ExpireDate>
  <ExternalContractID>sample string 21</ExternalContractID>
  <FreightOnBoard>true</FreightOnBoard>
  <FuturesMonthID>sample string 9</FuturesMonthID>
  <FuturesPrice>13.1</FuturesPrice>
  <LocationID>sample string 2</LocationID>
  <PriceByDate>sample string 19</PriceByDate>
  <PricingNotes>sample string 18</PricingNotes>
  <PurchaseContractComments>
    <ClsGrPurCon.ClsGrPurConAdd.ClsGrPurConCommAdd>
      <Comment>sample string 1</Comment>
    </ClsGrPurCon.ClsGrPurConAdd.ClsGrPurConCommAdd>
    <ClsGrPurCon.ClsGrPurConAdd.ClsGrPurConCommAdd>
      <Comment>sample string 1</Comment>
    </ClsGrPurCon.ClsGrPurConAdd.ClsGrPurConCommAdd>
  </PurchaseContractComments>
  <PurchaseContractDeliveryDates>
    <ClsGrPurCon.ClsGrPurConAdd.ClsGrPurConDdAdd>
      <CompleteDate>sample string 2</CompleteDate>
      <Quantity>3.1</Quantity>
      <StartDate>sample string 1</StartDate>
    </ClsGrPurCon.ClsGrPurConAdd.ClsGrPurConDdAdd>
    <ClsGrPurCon.ClsGrPurConAdd.ClsGrPurConDdAdd>
      <CompleteDate>sample string 2</CompleteDate>
      <Quantity>3.1</Quantity>
      <StartDate>sample string 1</StartDate>
    </ClsGrPurCon.ClsGrPurConAdd.ClsGrPurConDdAdd>
  </PurchaseContractDeliveryDates>
  <SalespersonID>sample string 17</SalespersonID>
  <ShippingDestinationID>sample string 16</ShippingDestinationID>
  <StrikePrice>11.1</StrikePrice>
</ClsGrPurCon.ClsGrPurConAdd>

application/x-www-form-urlencoded

Sample:

Failed to generate the sample for media type 'application/x-www-form-urlencoded'. Cannot use formatter 'JQueryMvcFormUrlEncodedFormatter' to write type 'ClsGrPurConAdd'.

Response Information

Resource Description

Create a purchase contract

AgvPurchaseContractDetails
NameDescriptionTypeAdditional Information
Status

0 - Success; 1 - An error occurred; 2 - An error occurred; 3 - Descriptive message, process was successful

string
Message

Informational message that corresponds to the Status returned; 0 - Message will be "OK"; 1 - Detailed message returned to give user an indication of what went wrong; 2 - Less detailed message returned that may not mean anything to the user but that the application might use to take a corrective action; 3 - Not an error but something the user might need to know

string
Count

The number of results returned.

string
PurchaseContract

ClsGrPurCon

Response Formats

application/json, text/json

Sample:
{
  "Status": "sample string 1",
  "Message": "sample string 2",
  "Count": "1",
  "PurchaseContract": {
    "Contract": "sample string 1",
    "CustID": "sample string 2",
    "Location": "sample string 3",
    "Commodity": "sample string 4",
    "Dateest": "sample string 5",
    "ExpireDate": "sample string 6",
    "ContractStatus": "sample string 7",
    "ContractType": "sample string 8",
    "CashPrice": 9.1,
    "ContractQuantity": 10.1,
    "QuantityRecvd": 11.1,
    "Basisprice": 12.1,
    "FuturesMonth": "sample string 13",
    "Exchange": "sample string 15",
    "StrikePrice": 16.1,
    "Futuresprice": 17.1,
    "ContractSigned": true,
    "BidCriteria": "sample string 19",
    "ShipDestination": "sample string 20",
    "OriginContract": "sample string 21",
    "OriginLocation": "sample string 22",
    "SalesmanID": "sample string 23",
    "PricingNotes": "sample string 24",
    "IsSpot": true,
    "originalContractQuantity": 26.1,
    "PurchaseContractGuid": "d5b8f68b-2b81-4b7f-9de7-2955e77fffc5",
    "ContractFormat": "sample string 35",
    "DirectShipped": true,
    "LastModifiedUTC": "2022-12-08T03:22:32.168977+00:00",
    "PurchaseContractDeliveryDates": [
      {
        "Contract": "sample string 1",
        "Location": "sample string 2",
        "Lineitem": "3",
        "StartDate": "sample string 4",
        "Quantity": "5.1",
        "CompleteDate": "sample string 6"
      },
      {
        "Contract": "sample string 1",
        "Location": "sample string 2",
        "Lineitem": "3",
        "StartDate": "sample string 4",
        "Quantity": "5.1",
        "CompleteDate": "sample string 6"
      }
    ],
    "PurchaseContractGradeFactors": [
      {
        "Contract": "sample string 1",
        "Location": "sample string 2",
        "Lineitem": "3",
        "GradFact": "sample string 4",
        "Schedule": "sample string 5",
        "Commodity": "sample string 6"
      },
      {
        "Contract": "sample string 1",
        "Location": "sample string 2",
        "Lineitem": "3",
        "GradFact": "sample string 4",
        "Schedule": "sample string 5",
        "Commodity": "sample string 6"
      }
    ],
    "PurchaseContractComments": [
      {
        "CommentDate": "sample string 4",
        "Comment": "sample string 5"
      },
      {
        "CommentDate": "sample string 4",
        "Comment": "sample string 5"
      }
    ]
  }
}

application/xml

Sample:

An exception has occurred while using the formatter 'XmlMediaTypeFormatter' to generate sample for media type 'application/xml'. Exception message: No set method for property 'QuantityAsStringForApi' in type 'SKY.Core.Grain.ClsGrPurCon+ClsGrPurConDd'.

text/xml

Sample:

An exception has occurred while using the formatter 'XmlMediaTypeFormatter' to generate sample for media type 'text/xml'. Exception message: No set method for property 'QuantityAsStringForApi' in type 'SKY.Core.Grain.ClsGrPurCon+ClsGrPurConDd'.