Forum Discussion

FICO's avatar
FICO
Community Manager
3 years ago

How to use REST API 4 to modify an entity value

I'm looking at the following documentation from FICO on modifying an entity value in a scenario but doesn't under what "dimension" mentions in this context. Could you provide an example of what it is if I want to change entity x to value 1 or to a string 'hello', etc.

If you have Python sample code doing that, that would be even better. Thank you.

https://www.fico.com/fico-xpress-optimization/docs/latest/insight/rest_api/resource_ScenarioResource.html?scroll=path__v1_data_scenario_-id-_data_entity_-entityName-_-dimension-.html

/v1/data/scenario/{id}/data/entity/{scalarName}/{dimension}

PUT

Modifies a specific dimension of a scalar value.

Response codes indicate the following:

  • 204 No Content: Update successful
  • 400 Bad Request: The scalar value could not be parsed
  • 404 Not Found: The scenario or entity could not be found
  • 423 Locked: The scenario is currently locked so could not be updated

Parameters

namedescriptiontypedefaultidThe id of the scenariopathscalarNameThe name of the scalar to updatepathdimensionThe dimension to updatepath

1 Reply

  • FICO's avatar
    FICO
    Community Manager

    Chang,

    The dimension refers to the entity dimension which you can find more information about here: https://www.fico.com/fico-xpress-optimization/docs/latest/insight_dev_guide/GUID-BCA42913-8334-46E3-96BB-75A5F15282DB.html

    However, you are most likely wanting to modify the data value of the scalar which is dimension 0 and is the default (so you can leave off dimension entirely). To do this you can PUT to /v1/data/scenario/{id}/data/entity/{scalarName} with the body of the request containing the value you want to set the entity to.

    Included with insight is an example of interacting with the REST API, written in javascript. You can find it in: [xpress_installation_directory]\examples\insight\rest_api\rest-client-example. There is no usage of this specific endpoint but it might help in general use of the REST API.

    Regards,

    Ian