# Session context modification

## Deleting an attribute from a session context

> Removes a particular attribute from a specified session context.\
> Recommended for performing calls on the management side. \
> \
> \*\*Note\*\*: Optimistic locking is not taken into account here.<br>

```json
{"openapi":"3.0.0","info":{"title":"Session Context Service","version":"0.0.1"},"tags":[{"name":"Session context modification"}],"servers":[{"url":"https://api.emporix.io"}],"security":[{"OAuth2":["sessioncontext.context_manage"]}],"components":{"securitySchemes":{"OAuth2":{"type":"oauth2","flows":{"clientCredentials":{"tokenUrl":"https://api.emporix.io/oauth/token","scopes":{"sessioncontext.context_manage":"Manage session context"}}}}},"responses":{"204_DELETE_attributeName":{"description":"The request was successful. The attribute has been deleted from the session context."},"404_session":{"description":"A session context with the provided ID was not found.","content":{"application/json":{"schema":{"allOf":[{"type":"object","properties":{"sessionId":{"type":"string","description":"Unique identifier of the session."}}},{"$ref":"#/components/schemas/ErrorMessage"}]}}}},"500_common":{"description":"A server-side error occurred.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorMessage"}}}}},"schemas":{"ErrorMessage":{"type":"object","properties":{"code":{"type":"integer","description":"HTTP Status Code"},"message":{"type":"string","description":"Detailed error message"}}}}},"paths":{"/session-context/{tenant}/context/{sessionId}/attributes/{attributeName}":{"delete":{"tags":["Session context modification"],"summary":"Deleting an attribute from a session context","operationId":"DELETE-session-context-remove-attribute","description":"Removes a particular attribute from a specified session context.\nRecommended for performing calls on the management side. \n\n**Note**: Optimistic locking is not taken into account here.\n","responses":{"204":{"$ref":"#/components/responses/204_DELETE_attributeName"},"404":{"$ref":"#/components/responses/404_session"},"500":{"$ref":"#/components/responses/500_common"}}}}}}
```

## Adding a new attribute to a session context

> Adds an attribute to a session context file for a session with a given sessionId. \
> Recommended for performing calls on the management side.\
> \
> \*\*Note\*\*: Optimistic locking is not taken into account here.

```json
{"openapi":"3.0.0","info":{"title":"Session Context Service","version":"0.0.1"},"tags":[{"name":"Session context modification"}],"servers":[{"url":"https://api.emporix.io"}],"security":[{"OAuth2":["sessioncontext.context_manage"]}],"components":{"securitySchemes":{"OAuth2":{"type":"oauth2","flows":{"clientCredentials":{"tokenUrl":"https://api.emporix.io/oauth/token","scopes":{"sessioncontext.context_manage":"Manage session context"}}}}},"responses":{"204_POST_attributes":{"description":"The request was successful. The attribute was added to the session context."},"404_session":{"description":"A session context with the provided ID was not found.","content":{"application/json":{"schema":{"allOf":[{"type":"object","properties":{"sessionId":{"type":"string","description":"Unique identifier of the session."}}},{"$ref":"#/components/schemas/ErrorMessage"}]}}}},"500_common":{"description":"A server-side error occurred.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorMessage"}}}}},"schemas":{"ErrorMessage":{"type":"object","properties":{"code":{"type":"integer","description":"HTTP Status Code"},"message":{"type":"string","description":"Detailed error message"}}},"ContextAttribute":{"title":"ContextAttribute","description":"Context attribute","type":"object","properties":{"key":{"type":"string","description":"Additional context information key"},"value":{"description":"Additional context information value","oneOf":[{"type":"object"},{"type":"string"}]}},"required":["key","value"]}},"requestBodies":{"attributes_POST":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContextAttribute"}}}}}},"paths":{"/session-context/{tenant}/context/{sessionId}/attributes":{"post":{"tags":["Session context modification"],"summary":"Adding a new attribute to a session context","operationId":"POST-session-context-add-attribute-sessionId","description":"Adds an attribute to a session context file for a session with a given sessionId. \nRecommended for performing calls on the management side.\n\n**Note**: Optimistic locking is not taken into account here.","responses":{"204":{"$ref":"#/components/responses/204_POST_attributes"},"404":{"$ref":"#/components/responses/404_session"},"500":{"$ref":"#/components/responses/500_common"}},"requestBody":{"$ref":"#/components/requestBodies/attributes_POST"}}}}}
```
