Hi I used multipartpost to post data using okHttpUtil2.
I used map for values/data. But I have to send map with a map (arrays of array).
The map(array) is working fine. But the arrays of array is not working(is not inserted)
Following is the code I used.
for the above curl I used following b4a code
Main details (email,first name,last name,username) is inserted but the Billing information is not inserted
I searched but I couldn't found what I missed.
Can anyone please help me
I used map for values/data. But I have to send map with a map (arrays of array).
The map(array) is working fine. But the arrays of array is not working(is not inserted)
Following is the code I used.
B4X:
curl -X POST https://example.com/wp-json/wc/v2/customers \
-u consumer_key:consumer_secret \
-H "Content-Type: application/json" \
-d '{
"email": "john.doe@example.com",
"first_name": "John",
"last_name": "Doe",
"username": "john.doe",
"billing": {
"first_name": "John",
"email": "john.doe@example.com",
"phone": "(555) 555-5555"
},
for the above curl I used following b4a code
B4X:
Dim Bill As Map
Bill.Initialize
Bill.Put("first_name","John")
Bill.Put("email","john.doe@example.com")
Bill.Put("phone","(555) 555-5555")
Dim D As Map
D.Initialize
D.Put("email","john.doe@example.com")
D.Put("first_name",Home.CUSDetail.Get("Username"))
D.Put("last_name",Home.CUSDetail.Get("Username"))
D.Put("username",Home.CUSDetail.Get("Username"))
D.Put("billing",Bill)
Dim Job As HttpJob
Job.Initialize("Register",Me)
Job.Username = "ck_5Xxxxxxxxxxc0"
Job.Password = "cs_f38xxxxxxxxxxfa7"
Job.PostMultipart("https://example.com/wp-json/wc/v2/customers",D,Null)
Job.GetRequest.SetHeader("Content-Type", "application/json")
Job.GetRequest.SetContentEncoding("text/plain")
Main details (email,first name,last name,username) is inserted but the Billing information is not inserted
I searched but I couldn't found what I missed.
Can anyone please help me