Lianja
Lianja
Akeneo: Create New Attribute Group
See more HTTP Misc Examples
Demonstrates how to create a new attribute group.Chilkat Lianja Downloads
llSuccess = .F.
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
loHttp = createobject("CkHttp")
// Use your previously obtained access token.
// See Get Akeneo Access Token
loHttp.AuthToken = "access_token"
// Build the following JSON to be sent in the request body:
// Use this online tool to generate the code from sample JSON:
// Generate Code to Create JSON
// {
// "code": "marketing",
// }
loJson = createobject("CkJsonObject")
loJson.UpdateString("code","marketing")
loJson.EmitCompact = .F.
// Show the JSON to be sent..
? loJson.Emit()
lcUrl = "http://pim.my-akeneo-site.com/api/rest/v1/attribute-groups"
loResp = createobject("CkHttpResponse")
llSuccess = loHttp.HttpJson("POST",lcUrl,loJson,"application/json",loResp)
if (llSuccess = .F.) then
? loHttp.LastErrorText
release loHttp
release loJson
release loResp
return
endif
// Success is a 201 response status code with an empty body.
? "Response Status Code: " + str(loResp.StatusCode)
? "Response Body: "
? loResp.BodyStr
release loHttp
release loJson
release loResp