on 2019 Nov 25 3:12 PM
Hello experts,
one of my OData-Payloads is giving me a hard time. I checked the API numerous times, all the mandatory fields are filled and I'm at a loss why I keep getting a 400 - Bad Request. If I remove the 'AgreementTerms' part it works perfectly fine, but I can't get it to work as a whole.
--batch
Content-Type: multipart/mixed; boundary=changeset_1
--changeset_1
Content-Type: application/http
Content-Transfer-Encoding: binary
PATCH Agreements(MKT_AgreementOrigin='CRM',MKT_AgreementExternalID='40001') HTTP/1.1
Content-Type: application/json
Content-Length: ###
Sap-Cuan-SourceSystemId: XXXCLN123
Sap-Cuan-SourceSystemType:
Sap-Cuan-SequenceId: AGREEMENT_MASTER_DATA
Sap-Cuan-RequestTimestamp: 20170508141617.0000001
Sap-Cuan-ExternalReferenceId: XXXCLN12320170508141617_01
{
"MKT_AgreementOrigin":"CRM",
"MKT_AgreementExternalID":"40001",
"ContactID":"20001",
"ContactOrigin":"MAFIS",
"MKT_AgreementType":"VERTR_STRO",
"MKT_AgreementStartDateTime":"2018-01-01T00:00:00",
"MKT_AgreementEndDateTime":"2019-12-31T00:00:00",
"MKT_MarketingArea":"ENERGIE",
"MKT_AgreementIsCanceled":false,
"MKT_AgrmtCancellationReason":"",
"YY1_CONSUMPTION_VALUE_MKT":"5000",
"YY1_CONSUMPTION_UNIT_MKT":"kWh",
"OriginDataLastChgUTCDateTime":"/Date(1574636400000)/"
}
--changeset_1
Content-Type: application/http
Content-Transfer-Encoding: binary
PATCH AgreementTerms(MKT_AgreementOrigin='CRM',MKT_AgreementExternalID='40001',MKT_AgrmtTermsStartDateTime='2018-01-01T00:00:00',MKT_AgrmtTermsEndDateTime='2019-12-31T00:00:00') HTTP/1.1
Content-Type: application/json
Content-Length: ###
Sap-Cuan-SourceSystemId: XXXCLN123
Sap-Cuan-SourceSystemType:
Sap-Cuan-SequenceId: AGREEMENT_MASTER_DATA
Sap-Cuan-RequestTimestamp: 20170508141617.0000001
Sap-Cuan-ExternalReferenceId: XXXCLN12320170508141617_01
{
"MKT_AgreementStatus":"A",
"MKT_AgreementRenewalType":"3",
"ProductOrigin":"CRM",
"ProductID":"STROM_PRODUKT_1",
"MKT_AgrmtCanclnConditions":"3",
"MKT_AgreementPaymentFrequency":"4",
"OriginDataLastChgUTCDateTime":"/Date(1574636400000)/"
}
--changeset_1--
--batch--
I would be very thankfu for any ideas.
Request clarification before answering.
Hi Maximilian,
just add an empty line in front of PATCH:
....
--changeset_1
Content-Type: application/http
Content-Transfer-Encoding: binary
PATCH Agreements(MKT_AgreementOrigin='CRM',MKT_AgreementExternalID='40001') HTTP/1.1
Content-Type: application/json
Content-Length: ###
....
Best Regards,
Wolfgang
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you Wolfgang, but that was just a formatting error by copying it here. The payload looks like this:
--batch
Content-Type: multipart/mixed; boundary=changeset_1
--changeset_1
Content-Type: application/http
Content-Transfer-Encoding: binary
PATCH Agreements(MKT_AgreementOrigin='CRM',MKT_AgreementExternalID='40001') HTTP/1.1
Content-Type: application/json
Content-Length: ###
Sap-Cuan-SourceSystemId: XXXCLN123
Sap-Cuan-SourceSystemType:
Sap-Cuan-SequenceId: AGREEMENT_MASTER_DATA
Sap-Cuan-RequestTimestamp: 20170508141617.0000001
Sap-Cuan-ExternalReferenceId: XXXCLN12320170508141617_01
{
"MKT_AgreementOrigin":"CRM",
"MKT_AgreementExternalID":"40001",
"ContactID":"20001",
"ContactOrigin":"MAFIS",
"MKT_AgreementType":"VERTR_STRO",
"MKT_AgreementStartDateTime":"2018-01-01T00:00:00",
"MKT_AgreementEndDateTime":"2019-12-31T00:00:00",
"MKT_MarketingArea":"ENERGIE",
"MKT_AgreementIsCanceled":false,
"MKT_AgrmtCancellationReason":"",
"YY1_CONSUMPTION_VALUE_MKT":"5000",
"YY1_CONSUMPTION_UNIT_MKT":"kWh",
"OriginDataLastChgUTCDateTime":"/Date(1574636400000)/"
}
--changeset_1
Content-Type: application/http
Content-Transfer-Encoding: binary
PATCH AgreementTerms(MKT_AgreementOrigin='CRM',MKT_AgreementExternalID='40001',MKT_AgrmtTermsStartDateTime=datetimeoffset'2018-01-01T00:00:01Z',MKT_AgrmtTermsEndDateTime=datetimeoffset'2019-12-31T00:00:01Z') HTTP/1.1
Content-Type: application/json
Content-Length: ###
Sap-Cuan-SourceSystemId: XXXCLN123
Sap-Cuan-SourceSystemType:
Sap-Cuan-SequenceId: AGREEMENT_MASTER_DATA
Sap-Cuan-RequestTimestamp: 20170508141617.0000001
Sap-Cuan-ExternalReferenceId: XXXCLN12320170508141617_01
{
"MKT_AgreementOrigin":"CRM",
"MKT_AgreementExternalID":"40001",
"MKT_AgrmtTermsStartDateTime":"2018-01-01T00:00:00",
"MKT_AgrmtTermsEndDateTime="2019-12-31T00:00:00",
"MKT_AgreementStatus":"A",
"MKT_AgreementRenewalType":"3",
"ProductOrigin":"CRM",
"ProductID":"STROM_PRODUKT_1",
"MKT_AgrmtCanclnConditions":"3",
"MKT_AgreementPaymentFrequency":"4",
"OriginDataLastChgUTCDateTime":"/Date(1574636400000)/"
}
--changeset_1--
--batch--
User | Count |
---|---|
7 | |
2 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.