# SAML app- Is there API to update attribute statement

**URL:** <https://devforum.okta.com/t/saml-app-is-there-api-to-update-attribute-statement/24595>\
**Category:** Questions\
**Created:** [June 16, 2023, 4:43pm UTC](https://devforum.okta.com/t/saml-app-is-there-api-to-update-attribute-statement/24595 "2023-06-16T16:43:49Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lena1](https://avatars.discourse-cdn.com/v4/letter/l/8797f3/32.png) [@Lena1](https://devforum.okta.com/u/Lena1)\
**Post date:** [June 16, 2023, 4:43pm UTC](https://devforum.okta.com/t/saml-app-is-there-api-to-update-attribute-statement/24595/1 "2023-06-16T16:43:49Z")

</div>

Hello,  
I’m looking for a way to update attribute statement array of custom SAML2.0 application.  
Currently I only see a way to define attribute statement during app creation. What happens if I need to update only the attribute statement array part?Is there a way to do that without re-creating the whole app?

> **[Apps | Okta Developer](https://developer.okta.com/docs/reference/api/apps/#add-saml-2-0-authentication-application)**
>
> Secure, scalable, and highly available authentication and user management for any app.

The idea is to add additional section here as a part of the app update call and not app creation: “attributeStatements”: [  
{  
“type”: “EXPRESSION”,  
“name”: “NameFormat”,  
“namespace”: “urn:oasis:names:tc:SAML:2.0:attrname-format:uri”,  
“values”: [  
“urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified”  
]  
},  
{  
“type”: “EXPRESSION”,  
“name”: “sn”,  
“namespace”: “urn:oasis:names:tc:SAML:2.0:attrname-format:uri”,  
“values”: [  
“user.lastName”  
]  
},  
{  
“type”: “EXPRESSION”,  
“name”: “givenName”,  
“namespace”: “urn:oasis:names:tc:SAML:2.0:attrname-format:uri”,  
“values”: [  
“user.firstName”  
]  
}

**NEW ATTRIBUTE WILL GO HERE** \*\*\*\*  
]

---

<div class="post-metadata">

**Author:** ![erik](https://avatars.discourse-cdn.com/v4/letter/e/b5ac83/32.png) [@erik](https://devforum.okta.com/u/erik)\
**Post date:** [June 17, 2023, 6:40am UTC](https://devforum.okta.com/t/saml-app-is-there-api-to-update-attribute-statement/24595/2 "2023-06-17T06:40:30Z")

</div>

You can use the API to do a GET for your SAML app, and then do an update where you add your attribute statements to the `signOn` section.

> **[Apps | Okta Developer](https://developer.okta.com/docs/reference/api/apps/#update-application)**
>
> Secure, scalable, and highly available authentication and user management for any app.

```auto
...
 "signOn": {
            "defaultRelayState": "",
             ...
            "attributeStatements": [
                    {
                        "type": "EXPRESSION",
                        "name": "firstName",
                        "namespace": "urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified",
                        "values": [
                            "ValueFromAPI"
                        ]
                    }
                ],
            "inlineHooks": [],
            ...
},
...

```

---

<div class="post-metadata">

**Author:** ![Lena1](https://avatars.discourse-cdn.com/v4/letter/l/8797f3/32.png) [@Lena1](https://devforum.okta.com/u/Lena1)\
**Post date:** [June 19, 2023, 7:05pm UTC](https://devforum.okta.com/t/saml-app-is-there-api-to-update-attribute-statement/24595/3 "2023-06-19T19:05:24Z")

</div>

Thank you @erik yes, it worked for me. I had to convert the response into python object, update as you mentioned, convert back onto json object and post back:  
response = requests.get(url=URL+f"/{app\_id}“, headers=headers)  
json\_result= response.json()  
new\_struct= {  
“type”: “GROUP”,  
“name”: “thenameyouassign”,  
“namespace”: “urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified”,  
“filterType”: “EQUALS”,  
“filterValue”: “your-filter”  
}  
json\_result[‘settings’][‘signOn’][‘attributeStatements’].append(new\_struct)  
response = requests.put(url=URL+f”/{app\_id}", headers=headers, data=json.dumps(json\_result))

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/oktadev/original/1X/589c4c5f80de422d01f47cee7185a7fb8227835c.png) [@system](https://devforum.okta.com/u/system)\
**Post date:** [June 26, 2023, 12:15am UTC](https://devforum.okta.com/t/saml-app-is-there-api-to-update-attribute-statement/24595/4 "2023-06-26T00:15:29Z")

</div>

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.
