Hitachi Ops Center​

 View Only

 HTTP POST or REST CLIENT ? SEND TO API WITH PENTAHO (PDI)

Micael Custodio's profile image
Micael Custodio posted 12-10-2021 14:20
Could someone help?
I need to send a json to an authenticated api, but I don't know how to do that. do you have any example of the steps of how to do this?
Vinod Subramaniam's profile image
Vinod Subramaniam
See example below:-

You need to be more specific to get an answer here.

[root@opsvm1-ps trace]# curl -H "Accept: application/json" -H "Content-Type:application/json" -H "Authorization:Basic bWFpbnRlbmFuY2U6cmFpZC1tYWludGVuYW5jZQ==" -X POST http://127.0.0.1:23450/ConfigurationManager/v1/objects/storages/900000033832/sessions

{
"token" : "7af518b6-1c42-40f6-96b6-1b16ff6442cf",
"sessionId" : 247
}

[root@opsvm1-ps trace]# curl -H "Accept: application/json" -H "Content-Type:application/json" -H "Authorization:Basic bWFpbnRlbmFuY2U6cmFpZC1tYWludGVuYW5jZQ==" -X GET http://127.0.0.1:23450/ConfigurationManager/v1/objects/storages/900000033832
{
"storageDeviceId" : "900000033832",
"model" : "VSP 5100",
"serialNumber" : 33832,
"svpIp" : "172.37.4.61",
"rmiPort" : 11099,
"dkcMicroVersion" : "90-06-01/41",
"communicationModes" : [ {
"communicationMode" : "lanConnectionMode"
} ],
"isSecure" : true
}

[root@opsvm1-ps trace]# vi Payload.json

[root@opsvm1-ps trace]# cat Payload.json
{
"parameters": {
"communicationModes": [
{
"communicationMode": "fcConnectionMode"
}
]
}
}




[root@opsvm1-ps trace]# curl -H "Accept: application/json" -H "Content-Type:application/json" -H "Authorization:Basic bWFpbnRlbmFuY2U6cmFpZC1tYWludGVuYW5jZQ==" --data-binary @./Payload.json -X POST http://127.0.0.1:23450/ConfigurationManager/v1/900000033832/services/communication-mode/actions/change/invoke
{
"jobId" : 4611686018427387904,
"self" : "/ConfigurationManager/v1/objects/storages/900000033832/jobs/4611686018427387904",
"userId" : "maintenance",
"status" : "Initializing",
"state" : "Queued",
"createdTime" : "2021-12-02T18:42:12Z",
"updatedTime" : "2021-12-02T18:42:12Z",
"request" : {
"requestUrl" : "/ConfigurationManager/v1/900000033832/services/communication-mode/actions/change/invoke",
"requestMethod" : "POST",
"requestBody" : "{\n \"parameters\": {\n \"communicationModes\": [\n {\n \"communicationMode\": \"fcConnectionMode\"\n }\n ]\n }\n}\n"
}
}[root@opsvm1-ps trace]#


[root@opsvm1-ps trace]#curl -H "Accept: application/json" -H "Content-Type:application/json" -H "Authorization:Basic bWFpbnRlbmFuY2U6cmFpZC1tYWludGVuYW5jZQ==" -X GET http://127.0.0.1:23450/ConfigurationManager/v1/objects/storages/900000033832
{
"storageDeviceId" : "900000033832",
"model" : "VSP 5100",
"serialNumber" : 33832,
"svpIp" : "172.37.4.61",
"rmiPort" : 11099,
"dkcMicroVersion" : "90-06-01/41",
"communicationModes" : [ {
"communicationMode" : "fcConnectionMode"
} ],
"isSecure" : true
}
William Jansen van Nieuwenhuizen's profile image
William Jansen van Nieuwenhuizen
Hello

Is there anything specific you want to do? The Knowledge base is a great source, have a look below with examples on how to do certain common operations:
https://knowledge.hitachivantara.com/Documents/Management_Software/Ops_Center/API_Configuration_Manager/10.8.x/REST_API_Reference_Guide/02_Common_operations_in_the_REST_API

Feel free to check out more operations here:
https://knowledge.hitachivantara.com/Documents/Management_Software/Ops_Center/10.8.x/API_Configuration_Manager

Best Regards
William
Micael Custodio's profile image
Micael Custodio
sorry if I wasn't specific but it would send the object (json) to an authenticated api to receive the data. I don't know how to do this process in pentaho (PDI).