Hello everybody,
I want to retrieve an element from an "Actif (DT)" JSON and post it for each of the lines in HTTP.
I managed to build the JSON array but I block to make an "apply to each" loop ...
Anyone have an idea to create a loop that will retrieve "Actif (DT)" in each of the lines?
Solved! Go to Solution.
Hi @Kevint13
I just realised my previous schema I provided you was based on the full JSON output and not just the body section. Try this schema instead and let me know if that solves the issue.
{
"type": "array",
"items": {
"type": "object",
"properties": {
"\"Id (DT)\"": {
"type": "string"
},
"\"Actif (DT)\"": {
"type": "string"
},
"\"Fiche MP (DT)\"": {
"type": "string"
},
"\"Gamme d'operation\"": {
"type": "string"
},
"\"Gamme (DT)\"": {
"type": "string"
},
"\"N° fiche MP\"": {
"type": "string"
},
"\"N° Fiche MP de reference\"": {
"type": "string"
},
"\"Date de demande (DT)\"": {
"type": "string"
},
"\"Ancien statut (Hist DT)\"": {
"type": "string"
},
"\"Date objectif/statut si FERME/TERMI (DT)\"": {
"type": "string"
},
"\"Description détaillée remarque probleme (DT)\"": {
"type": "string"
},
"\"Durée réelle (DT)\"": {
"type": "string"
},
"\"Description Unité (DT)\"": {
"type": "string"
},
"\"Imputation (DT)\"": {
"type": "string"
},
"\"Description détaillée probleme (DT)\"": {
"type": "string"
},
"\"Description Sous unité (DT)\"": {
"type": "string"
},
"\"Type Imputation (IM MO DT)\"": {
"type": "string"
},
"\"N° Imputation (IM MO DT)\"": {
"type": "string"
},
"\"Description Actif (DT)\"": {
"type": "string"
},
"\"Date remarque Problème (DT)\"": {
"type": "string"
},
"\"Date du rapport de panne (DT)\"": {
"type": "string"
},
"\"Date clôture (DT)\"": {
"type": "string"
},
"\"Description DI (DT)\"": {
"type": "string"
},
"\"N° DT\"": {
"type": "string"
},
"\"Description (DT)\"": {
"type": "string"
},
"\"Nom-Prénom Responsable (DT)\"": {
"type": "string"
},
"\"Date création (DT)\"": {
"type": "string"
},
"\"Date statut (DT)\"": {
"type": "string"
},
"\"Priorité (DT)\"": {
"type": "string"
},
"\"Type de travail (DT)\"": {
"type": "string"
},
"\"Métier (DT)\"": {
"type": "string"
},
"\"Action par (Equipe) (DT)\"": {
"type": "string"
},
"\"Emplacement (DT)\"": {
"type": "string"
},
"\"Statut (DT)\"": {
"type": "string"
},
"\"Problème (DT)\"": {
"type": "string"
},
"\"Date fin réelle (DT)\"": {
"type": "string"
},
"\"Remarque Problème (DT)\"": {
"type": "string"
},
"\"Date fin (MO DT)\"": {
"type": "string"
}
},
"required": [
"\"Id (DT)\"",
"\"Actif (DT)\"",
"\"Fiche MP (DT)\"",
"\"Gamme d'operation\"",
"\"Gamme (DT)\"",
"\"N° fiche MP\"",
"\"N° Fiche MP de reference\"",
"\"Date de demande (DT)\"",
"\"Ancien statut (Hist DT)\"",
"\"Date objectif/statut si FERME/TERMI (DT)\"",
"\"Description détaillée remarque probleme (DT)\"",
"\"Durée réelle (DT)\"",
"\"Description Unité (DT)\"",
"\"Imputation (DT)\"",
"\"Description détaillée probleme (DT)\"",
"\"Description Sous unité (DT)\"",
"\"Type Imputation (IM MO DT)\"",
"\"N° Imputation (IM MO DT)\"",
"\"Description Actif (DT)\"",
"\"Date remarque Problème (DT)\"",
"\"Date du rapport de panne (DT)\"",
"\"Date clôture (DT)\"",
"\"Description DI (DT)\"",
"\"N° DT\"",
"\"Description (DT)\"",
"\"Nom-Prénom Responsable (DT)\"",
"\"Date création (DT)\"",
"\"Date statut (DT)\"",
"\"Priorité (DT)\"",
"\"Type de travail (DT)\"",
"\"Métier (DT)\"",
"\"Action par (Equipe) (DT)\"",
"\"Emplacement (DT)\"",
"\"Statut (DT)\"",
"\"Problème (DT)\"",
"\"Date fin réelle (DT)\"",
"\"Remarque Problème (DT)\"",
"\"Date fin (MO DT)\""
]
}
}
Proud to be a Flownaut!
Follow me on Twitter at @QG_LeeJHarris
Or on LinkedIn at in/leejharris
Hi @Kevint13
Please can you post a sample of your JSON output in text format and I'll be happy to take a look at this for you.
Proud to be a Flownaut!
Follow me on Twitter at @QG_LeeJHarris
Or on LinkedIn at in/leejharris
Hi @LeeHarris,
Here is a copy paste from json :
{"statusCode":200,"headers":{"Transfer-Encoding":"chunked","Date":"Sun, 12 Jan 2020 19:43:33 GMT","Server":"Kestrel","X-Powered-By":"ASP.NET","Content-Type":"application/json; charset=utf-8","Content-Length":"2930900"},"body":[{"\"Id (DT)\"":"\"32310875\"","\"Actif (DT)\"":"\"LVR105516\"","\"Fiche MP (DT)\"":"\"MPR-63484\"","\"Gamme d'operation\"":"\"CLIM1472076\"","\"Gamme (DT)\"":"\"CLIM1472078\"","\"N° fiche MP\"":"\"MPR-63484\"","\"N° Fiche MP de reference\"":"\"\"","\"Date de demande (DT)\"":"\"2019/10/27 00:00:00\"","\"Ancien statut (Hist DT)\"":"\"APPR\"","\"Date objectif/statut si FERME/TERMI (DT)\"":"\"2019/11/01 00:00:00\"","\"Description détaillée remarque probleme (DT)\"":"\"Entretien Préventif Cassettes du CDC1 rien à signaler<!-- RICH TEXT -->\"","\"Durée réelle (DT)\"":"\"0","\"Description Unité (DT)\"":"35\"","\"Imputation (DT)\"":"\"MATERIELS DIVERS\"","\"Description détaillée probleme (DT)\"":"\"IM-80814\"","\"Description Sous unité (DT)\"":"\"\"","\"Type Imputation (IM MO DT)\"":"\"Centre de Conduite CDC1\"","\"N° Imputation (IM MO DT)\"":"\"PROJECT\"","\"Description Actif (DT)\"":"\"IM-80814\"","\"Date remarque Problème (DT)\"":"\"Ventilo-convecteur CASSETTE\"","\"Date du rapport de panne (DT)\"":"\"2019/11/27 11:12:37\"","\"Date clôture (DT)\"":"\"\"","\"Description DI (DT)\"":"\"\"","\"N° DT\"":"\"\"","\"Description (DT)\"":"\"DT-19-720651\"","\"Nom-Prénom Responsable (DT)\"":"\"Entretien Préventif Cassettes du CDC1\"","\"Date création (DT)\"":"\"Christian (CEGELEC ACTEMIUM) Riat\"","\"Date statut (DT)\"":"\"2019/10/27 00:00:00\"","\"Priorité (DT)\"":"\"2019/11/27 00:00:00\"","\"Type de travail (DT)\"":"\"4\"","\"Métier (DT)\"":"\"TBM\"","\"Action par (Equipe) (DT)\"":"\"CLIMATISATION\"","\"Emplacement (DT)\"":"\"R1NEEIAC\"","\"Statut (DT)\"":"\"CDC1.CLIM.VC34\"","\"Problème (DT)\"":"\"ATTENTESSAI\"","\"Date fin réelle (DT)\"":"\"\"","\"Remarque Problème (DT)\"":"\"2019/11/26 00:00:00\"","\"Date fin (MO DT)\"":"\"CR:\""},{"\"Id (DT)\"":"\"32310875\"","\"Actif (DT)\"":"\"LVR105516\"","\"Fiche MP (DT)\"":"\"MPR-63484\"","\"Gamme d'operation\"":"\"CLIM1472076\"","\"Gamme (DT)\"":"\"CLIM1472078\"","\"N° fiche MP\"":"\"MPR-63484\"","\"N° Fiche MP de reference\"":"\"\"","\"Date de demande (DT)\"":"\"2019/10/27 00:00:00\"","\"Ancien statut (Hist DT)\"":"\"ATTENTESSAI\"","\"Date objectif/statut si FERME/TERMI (DT)\"":"\"2019/11/01 00:00:00\"","\"Description détaillée remarque probleme (DT)\"":"\"Entretien Préventif Cassettes du CDC1 rien à signaler<!-- RICH TEXT -->\"","\"Durée réelle (DT)\"":"\"0","\"Description Unité (DT)\"":"35\"","\"Imputation (DT)\"":"\"MATERIELS DIVERS\"","\"Description détaillée probleme (DT)\"":"\"IM-80814\"","\"Description Sous unité (DT)\"":"\"\"","\"Type Imputation (IM MO DT)\"":"\"Centre de Conduite CDC1\"","\"N° Imputation (IM MO DT)\"":"\"PROJECT\"","\"Description Actif (DT)\"":"\"IM-80814\"","\"Date remarque Problème (DT)\"":"\"Ventilo-convecteur CASSETTE\"","\"Date du rapport de panne (DT)\"":"\"2019/11/27 11:12:37\"","\"Date clôture (DT)\"":"\"\"","\"Description DI (DT)\"":"\"\"","\"N° DT\"":"\"\"","\"Description (DT)\"":"\"DT-19-720651\"","\"Nom-Prénom Responsable (DT)\"":"\"Entretien Préventif Cassettes du CDC1\"","\"Date création (DT)\"":"\"Christian (CEGELEC ACTEMIUM) Riat\"","\"Date statut (DT)\"":"\"2019/10/27 00:00:00\"","\"Priorité (DT)\"":"\"2019/11/27 00:00:00\"","\"Type de travail (DT)\"":"\"4\"","\"Métier (DT)\"":"\"TBM\"","\"Action par (Equipe) (DT)\"":"\"CLIMATISATION\"","\"Emplacement (DT)\"":"\"R1NEEIAC\"","\"Statut (DT)\"":"\"CDC1.CLIM.VC34\"","\"Problème (DT)\"":"\"ATTENTESSAI\"","\"Date fin réelle (DT)\"":"\"\"","\"Remarque Problème (DT)\"":"\"2019/11/26 00:00:00\"","\"Date fin (MO DT)\"":"\"CR:\""},{"\"Id (DT) ...
Formatted it looks like this :
Hi @Kevint13
Add a new Parse JSON action to your Flow after you have received the JSON from your Get TOKEN step. Set the input of the Parse JSON action to the body of the Get TOKEN response and then set the schema to the below. For reference, this was generated by pasting in the JSON response as a sample and allowing Flow to generate it automatically.
{
"type": "object",
"properties": {
"statusCode": {
"type": "integer"
},
"headers": {
"type": "object",
"properties": {
"Transfer-Encoding": {
"type": "string"
},
"Date": {
"type": "string"
},
"Server": {
"type": "string"
},
"X-Powered-By": {
"type": "string"
},
"Content-Type": {
"type": "string"
},
"Content-Length": {
"type": "string"
}
}
},
"body": {
"type": "array",
"items": {
"type": "object",
"properties": {
"\"Id (DT)\"": {
"type": "string"
},
"\"Actif (DT)\"": {
"type": "string"
},
"\"Fiche MP (DT)\"": {
"type": "string"
},
"\"Gamme d'operation\"": {
"type": "string"
},
"\"Gamme (DT)\"": {
"type": "string"
},
"\"N° fiche MP\"": {
"type": "string"
},
"\"N° Fiche MP de reference\"": {
"type": "string"
},
"\"Date de demande (DT)\"": {
"type": "string"
},
"\"Ancien statut (Hist DT)\"": {
"type": "string"
},
"\"Date objectif/statut si FERME/TERMI (DT)\"": {
"type": "string"
},
"\"Description détaillée remarque probleme (DT)\"": {
"type": "string"
},
"\"Durée réelle (DT)\"": {
"type": "string"
},
"\"Description Unité (DT)\"": {
"type": "string"
},
"\"Imputation (DT)\"": {
"type": "string"
},
"\"Description détaillée probleme (DT)\"": {
"type": "string"
},
"\"Description Sous unité (DT)\"": {
"type": "string"
},
"\"Type Imputation (IM MO DT)\"": {
"type": "string"
},
"\"N° Imputation (IM MO DT)\"": {
"type": "string"
},
"\"Description Actif (DT)\"": {
"type": "string"
},
"\"Date remarque Problème (DT)\"": {
"type": "string"
},
"\"Date du rapport de panne (DT)\"": {
"type": "string"
},
"\"Date clôture (DT)\"": {
"type": "string"
},
"\"Description DI (DT)\"": {
"type": "string"
},
"\"N° DT\"": {
"type": "string"
},
"\"Description (DT)\"": {
"type": "string"
},
"\"Nom-Prénom Responsable (DT)\"": {
"type": "string"
},
"\"Date création (DT)\"": {
"type": "string"
},
"\"Date statut (DT)\"": {
"type": "string"
},
"\"Priorité (DT)\"": {
"type": "string"
},
"\"Type de travail (DT)\"": {
"type": "string"
},
"\"Métier (DT)\"": {
"type": "string"
},
"\"Action par (Equipe) (DT)\"": {
"type": "string"
},
"\"Emplacement (DT)\"": {
"type": "string"
},
"\"Statut (DT)\"": {
"type": "string"
},
"\"Problème (DT)\"": {
"type": "string"
},
"\"Date fin réelle (DT)\"": {
"type": "string"
},
"\"Remarque Problème (DT)\"": {
"type": "string"
},
"\"Date fin (MO DT)\"": {
"type": "string"
}
},
"required": [
"\"Id (DT)\"",
"\"Actif (DT)\"",
"\"Fiche MP (DT)\"",
"\"Gamme d'operation\"",
"\"Gamme (DT)\"",
"\"N° fiche MP\"",
"\"N° Fiche MP de reference\"",
"\"Date de demande (DT)\"",
"\"Ancien statut (Hist DT)\"",
"\"Date objectif/statut si FERME/TERMI (DT)\"",
"\"Description détaillée remarque probleme (DT)\"",
"\"Durée réelle (DT)\"",
"\"Description Unité (DT)\"",
"\"Imputation (DT)\"",
"\"Description détaillée probleme (DT)\"",
"\"Description Sous unité (DT)\"",
"\"Type Imputation (IM MO DT)\"",
"\"N° Imputation (IM MO DT)\"",
"\"Description Actif (DT)\"",
"\"Date remarque Problème (DT)\"",
"\"Date du rapport de panne (DT)\"",
"\"Date clôture (DT)\"",
"\"Description DI (DT)\"",
"\"N° DT\"",
"\"Description (DT)\"",
"\"Nom-Prénom Responsable (DT)\"",
"\"Date création (DT)\"",
"\"Date statut (DT)\"",
"\"Priorité (DT)\"",
"\"Type de travail (DT)\"",
"\"Métier (DT)\"",
"\"Action par (Equipe) (DT)\"",
"\"Emplacement (DT)\"",
"\"Statut (DT)\"",
"\"Problème (DT)\"",
"\"Date fin réelle (DT)\"",
"\"Remarque Problème (DT)\"",
"\"Date fin (MO DT)\""
]
}
}
}
}
After the Parse JSON step add another action such as a Compose and select the Actif (DT) property from Dynamic Content. Doing this will automatically generate the Apply to Each loop for you.
Hope that helps.
Proud to be a Flownaut!
Follow me on Twitter at @QG_LeeJHarris
Or on LinkedIn at in/leejharris
hi @LeeHarris ,
Thanks a lot for your answer,
I tried the code and got an error:
[
{
"message": "Invalid type. Expected Object but got Array.",
"lineNumber": 0,
"linePosition": 0,
"path": "",
"schemaId": "#",
"errorType": "type",
"childErrors": []
}
]
Hi @Kevint13
I just realised my previous schema I provided you was based on the full JSON output and not just the body section. Try this schema instead and let me know if that solves the issue.
{
"type": "array",
"items": {
"type": "object",
"properties": {
"\"Id (DT)\"": {
"type": "string"
},
"\"Actif (DT)\"": {
"type": "string"
},
"\"Fiche MP (DT)\"": {
"type": "string"
},
"\"Gamme d'operation\"": {
"type": "string"
},
"\"Gamme (DT)\"": {
"type": "string"
},
"\"N° fiche MP\"": {
"type": "string"
},
"\"N° Fiche MP de reference\"": {
"type": "string"
},
"\"Date de demande (DT)\"": {
"type": "string"
},
"\"Ancien statut (Hist DT)\"": {
"type": "string"
},
"\"Date objectif/statut si FERME/TERMI (DT)\"": {
"type": "string"
},
"\"Description détaillée remarque probleme (DT)\"": {
"type": "string"
},
"\"Durée réelle (DT)\"": {
"type": "string"
},
"\"Description Unité (DT)\"": {
"type": "string"
},
"\"Imputation (DT)\"": {
"type": "string"
},
"\"Description détaillée probleme (DT)\"": {
"type": "string"
},
"\"Description Sous unité (DT)\"": {
"type": "string"
},
"\"Type Imputation (IM MO DT)\"": {
"type": "string"
},
"\"N° Imputation (IM MO DT)\"": {
"type": "string"
},
"\"Description Actif (DT)\"": {
"type": "string"
},
"\"Date remarque Problème (DT)\"": {
"type": "string"
},
"\"Date du rapport de panne (DT)\"": {
"type": "string"
},
"\"Date clôture (DT)\"": {
"type": "string"
},
"\"Description DI (DT)\"": {
"type": "string"
},
"\"N° DT\"": {
"type": "string"
},
"\"Description (DT)\"": {
"type": "string"
},
"\"Nom-Prénom Responsable (DT)\"": {
"type": "string"
},
"\"Date création (DT)\"": {
"type": "string"
},
"\"Date statut (DT)\"": {
"type": "string"
},
"\"Priorité (DT)\"": {
"type": "string"
},
"\"Type de travail (DT)\"": {
"type": "string"
},
"\"Métier (DT)\"": {
"type": "string"
},
"\"Action par (Equipe) (DT)\"": {
"type": "string"
},
"\"Emplacement (DT)\"": {
"type": "string"
},
"\"Statut (DT)\"": {
"type": "string"
},
"\"Problème (DT)\"": {
"type": "string"
},
"\"Date fin réelle (DT)\"": {
"type": "string"
},
"\"Remarque Problème (DT)\"": {
"type": "string"
},
"\"Date fin (MO DT)\"": {
"type": "string"
}
},
"required": [
"\"Id (DT)\"",
"\"Actif (DT)\"",
"\"Fiche MP (DT)\"",
"\"Gamme d'operation\"",
"\"Gamme (DT)\"",
"\"N° fiche MP\"",
"\"N° Fiche MP de reference\"",
"\"Date de demande (DT)\"",
"\"Ancien statut (Hist DT)\"",
"\"Date objectif/statut si FERME/TERMI (DT)\"",
"\"Description détaillée remarque probleme (DT)\"",
"\"Durée réelle (DT)\"",
"\"Description Unité (DT)\"",
"\"Imputation (DT)\"",
"\"Description détaillée probleme (DT)\"",
"\"Description Sous unité (DT)\"",
"\"Type Imputation (IM MO DT)\"",
"\"N° Imputation (IM MO DT)\"",
"\"Description Actif (DT)\"",
"\"Date remarque Problème (DT)\"",
"\"Date du rapport de panne (DT)\"",
"\"Date clôture (DT)\"",
"\"Description DI (DT)\"",
"\"N° DT\"",
"\"Description (DT)\"",
"\"Nom-Prénom Responsable (DT)\"",
"\"Date création (DT)\"",
"\"Date statut (DT)\"",
"\"Priorité (DT)\"",
"\"Type de travail (DT)\"",
"\"Métier (DT)\"",
"\"Action par (Equipe) (DT)\"",
"\"Emplacement (DT)\"",
"\"Statut (DT)\"",
"\"Problème (DT)\"",
"\"Date fin réelle (DT)\"",
"\"Remarque Problème (DT)\"",
"\"Date fin (MO DT)\""
]
}
}
Proud to be a Flownaut!
Follow me on Twitter at @QG_LeeJHarris
Or on LinkedIn at in/leejharris
Power Automate User Groups are coming! Make sure you’re among the first to know when user groups go live for public preview.
User | Count |
---|---|
48 | |
10 | |
10 | |
10 | |
7 |
User | Count |
---|---|
75 | |
22 | |
14 | |
11 | |
11 |