Quantcast
Channel: DreamFactory Forum - Latest topics
Viewing all articles
Browse latest Browse all 1523

PHP Post to MSSQL with ServiceHandler

$
0
0

@Mike_Harvey wrote:

In lieu of existing documentation for the PHP classes, I am hoping someone could shed a little more light on this.

PHP - post process. I am trying to post a record to MS SQL DB. When I do this through the api_docs it works fine. But when I fire this from another post process, I get the error:

**Required field 'id_session' can not be NULL.**

I am certain the value is in my payload. I am calling the post using the service handler like this:

$auditPost= DreamFactory\Core\Utility\ServiceHandler::handleRequest('POST','ap-db','_table/Audit',[],$jsonPayload,'JSON','Content-Type: application/json');

What I am unsure of are the last two arguments, (the format, and the header) as I could not find any examples. I looked at the api_docs post in the chrome debugger, and this was my best guess. The $jsonPayload is well-formed json that works fine when submitted vi api_docs so I know the id_session value is there {
"resource": [{
"id_session": "10A4A35E-0D2B-4A27-A178-4A1F82E72FC2",
"form_name": "Toolbox Inspection",
"start_time": "2016-02-22 20:49:01",
"end_time": "2016-02-23 01:49:49",
"GenDate": "2016-02-23 01:49:49",
"InstitutionName": "Eddie's Garage",
"GenBuilding": "Back Shack",
"GenRoom": "6",
"GenAuditor": "Joey the Tool",
"Question_id": null,
"Violation_Flag": null,
"ShowRisk": false,
"Violation_CD": "CHEM_MSDS.001",
"Violation_Qty": null,
"Violation_Note": null
}]
}
}`

Any ideas would be great. TIA

Posts: 3

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 1523

Trending Articles