Android Question Curl Multi parts (Map) within MultipartPost (array with in array)

fasilosman

Active Member
Licensed User
I use okhttp for Curl with multipartpost.
there is an array within the multipart map/array variable
But I don't have idea to implement it.
following is the Curl
.....................
curl -X POST https://example.com/wp-json/wc/v2/products \
-u consumer_key:consumer_secret \
-H "Content-Type: application/json" \
-d '{
"name": "Ship Your Idea",
"type": "variable",
"description": "New Ideas and thoughts",
"attributes": [ {
"id": 6,
"name": "Color",
"visible": false,

"options": [
"Black",
"Green" ]

]
}
}
...................................

I Tried the following. I have no idea how to put the attribute and options. Therefore I can't continue
further
........................
Dim NV As Map
NV.Initialize
NV.Put("name", "Ship Your Idea")
NV.Put("type", "variable")
NV.Put("description", "New Ideas and thoughts")
NV.Put("attributes",???????????
Dim req As OkHttpRequest
req = MultipartPost.CreatePostRequest("https://example.com/wp-json/wc/v2/products", NV, Null)
req.SetHeader("Content-Type", "application/json")
req.SetContentType("application/json")
req.SetContentEncoding("text/plain")
hc.ExecuteCredentials(req,1,"consumer_key","consumer_secret")
...............................................................

I am a beginner. Can anyone please help me in this regard...
 
Top