H can anyone help me I am trying to do the following:
----------------------------------------------------------------------------------------------------
PUT face/v0/persongroups/1
Content-Type: application/json
Host: api.projectoxford.ai
Content-Length: 129
Ocp-Apim-Subscription-Key: ••••••••••••••••••••••••••••••••
{
"name":"sample_group",
"userData":"user-provided data attached to the person group"
}
----------------------------------------------------------------------------------------------------
This is what they require:
Face API
PersonGroup - Create a PersonGroup
Creates a new person group with a user-specified ID.
A person group is one of the most important parameters for the Identification API. The Identification searches person faces in a specified person group.
Http Method
PUT
Request parameters
personGroupId
Request headers
Content-Type
Ocp-Apim-Subscription-Key
Request body
JSON fields in request body:
name
String
Person group display name. The maximum length is 128.
userData
String
User-provided data attached to the person group. The size limit is 16KB.
---------------------------------------------------------------------------------------------------
My code looks like this:
Sub CreateGroup()
Try
Dim GroupMap As Map
GroupMap.Initialize
GroupMap.Put("name","sample_group")
GroupMap.Put("userData","sample group created")
Dim JSONGenerator As JSONGenerator
JSONGenerator.Initialize(GroupMap)
' JSONGenerator puts GroupMap.Put("userData","sample group created") first
' then GroupMap.Put("name","sample_group") last this is wrong sequence
Dim JSONstring As String
JSONstring = JSONGenerator.ToString
JSONstring = "{ ""name"":""sample_group"",""userData"":""sample group created"" }"
I tried hard coding json string
Dim job2 As HttpJob
job2.Initialize("job2",Me) ' Create Person Group
job2.PostString("https://api.projectoxford.ai/face/v0/persongroups/1",JSONstring)
job2.GetRequest.SetHeader("Content-Type","application/json")
job2.GetRequest.SetHeader("Ocp-Apim-Subscription-Key","xxxxxxxxxxxxxxxxxxxxxxxxxxx")
Catch
ToastMessageShow("Comms with Oxford failed",False)
End Try
End Sub
It does not work am I doing something stupid
Regards
Edmund
----------------------------------------------------------------------------------------------------
PUT face/v0/persongroups/1
Content-Type: application/json
Host: api.projectoxford.ai
Content-Length: 129
Ocp-Apim-Subscription-Key: ••••••••••••••••••••••••••••••••
{
"name":"sample_group",
"userData":"user-provided data attached to the person group"
}
----------------------------------------------------------------------------------------------------
This is what they require:
Face API
PersonGroup - Create a PersonGroup
Creates a new person group with a user-specified ID.
A person group is one of the most important parameters for the Identification API. The Identification searches person faces in a specified person group.
Http Method
PUT
Request parameters
personGroupId
Request headers
Content-Type
Ocp-Apim-Subscription-Key
Request body
JSON fields in request body:
name
String
Person group display name. The maximum length is 128.
userData
String
User-provided data attached to the person group. The size limit is 16KB.
---------------------------------------------------------------------------------------------------
My code looks like this:
Sub CreateGroup()
Try
Dim GroupMap As Map
GroupMap.Initialize
GroupMap.Put("name","sample_group")
GroupMap.Put("userData","sample group created")
Dim JSONGenerator As JSONGenerator
JSONGenerator.Initialize(GroupMap)
' JSONGenerator puts GroupMap.Put("userData","sample group created") first
' then GroupMap.Put("name","sample_group") last this is wrong sequence
Dim JSONstring As String
JSONstring = JSONGenerator.ToString
JSONstring = "{ ""name"":""sample_group"",""userData"":""sample group created"" }"
I tried hard coding json string
Dim job2 As HttpJob
job2.Initialize("job2",Me) ' Create Person Group
job2.PostString("https://api.projectoxford.ai/face/v0/persongroups/1",JSONstring)
job2.GetRequest.SetHeader("Content-Type","application/json")
job2.GetRequest.SetHeader("Ocp-Apim-Subscription-Key","xxxxxxxxxxxxxxxxxxxxxxxxxxx")
Catch
ToastMessageShow("Comms with Oxford failed",False)
End Try
End Sub
It does not work am I doing something stupid
Regards
Edmund