MC-René
Erfahrenes Mitglied
Hallo zusammen,
ich sende einen Request an die Microsoft API Cognitive Services.
Die Vorgabe seitens MS für den Body ist:
Mein Code für den Body:
Als Fehlermeldung bekomme ich:
"InvalidRequestBodyFormat" ["message"]=> "Request body format is wrong. Make sure the json request is serialized correctly and there are no null members"
Mein var_dump von $parameters2 sieht so aus:
Habt Ihr nen Tipp für mich!?
VG
MC
ich sende einen Request an die Microsoft API Cognitive Services.
Die Vorgabe seitens MS für den Body ist:
PHP:
{
"documents": [
{
"language": "en",
"id": "1",
"text": "First document"
},
...
{
"language": "en",
"id": "100",
"text": "Final document"
}
]
}
Mein Code für den Body:
PHP:
$parameters2 = array("documents"=>array('id'=>$meine_id,'text'=>$mein_text_string));
$parameters2=json_encode($parameters2, JSON_FORCE_OBJECT);
Als Fehlermeldung bekomme ich:
"InvalidRequestBodyFormat" ["message"]=> "Request body format is wrong. Make sure the json request is serialized correctly and there are no null members"
Mein var_dump von $parameters2 sieht so aus:
PHP:
string(151) "{"documents":{"id":"meineID","text":"Hier steht mein Textstring."}}"
Habt Ihr nen Tipp für mich!?
VG
MC