none
Can't change active build id with UpdateModel (Recommendations API) RRS feed

  • Question

  • Hi,

    I have a question with UpdateModel API of Azure Recommendations API.

    So far I successfully create a model, uploaded a catalogue and usage data, build a model, and query recommendations. But after I uploaded modified usage data and build, I noticed that I need to change active build id for the model. And I don't know exact way to do it.

    I'm doing all API calls with curl command on Mac OS X terminal (iTerm and bash), and I called UpdateModel like this.

    AUTH_BASE64="xxxxxx" # my authentication code (base64 encoded)

    MODEL_ID="e0fbf571-3100-46d0-a539-0777574b8e6c"

    API_URL="https://api.datamarket.azure.com/amla/recommendations/v2/"

    curl -X PUT -d "<ModelUpdateParams xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"><Description>HOGE</Description><ActiveBuildId>1526289</ActiveBuildId></ModelUpdateParams>" -H "Authorization: Basic ${AUTH_BASE64}" "${API_URL}UpdateModel?id=%27${MODEL_ID}%27&apiVersion=%271.0%27"

    The response is this:

    <feed xmlns:base="https://api.datamarket.azure.com/Data.ashx/amla/recommendations/v2/UpdateModel" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://www.w3.org/2005/Atom"><title type="text" /><subtitle type="text">Update an Existing Model</subtitle><id>https://api.datamarket.azure.com/Data.ashx/amla/recommendations/v2/UpdateModel?id='e0fbf571-3100-46d0-a539-0777574b8e6c'&amp;apiVersion='1.0'</id><rights type="text" /><updated>2015-06-18T10:43:49Z</updated><link rel="self" href="https://api.datamarket.azure.com/Data.ashx/amla/recommendations/v2/UpdateModel?id='e0fbf571-3100-46d0-a539-0777574b8e6c'&amp;apiVersion='1.0'" /></feed>

    But the active build id for the model does not change.

    Do you find something wrong ?

    Thanks,

    Makoto


    • Edited by mhamanaka Thursday, June 18, 2015 10:57 AM
    Thursday, June 18, 2015 10:52 AM

Answers

  • I solved the problem by adding Content-Type header.

    The resulted curl command line is like this.

    curl -X PUT -d '<ModelUpdateParams xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><Description>hello</Description><ActiveBuildId>1526289</ActiveBuildId></ModelUpdateParams>' -H "Content-Type: Application/xml" -H "Authorization: Basic ${AUTH_BASE64}" "${API_URL}UpdateModel?id=%27${MODEL_ID}%27&apiVersion=%271.0%27"

    Friday, June 19, 2015 2:52 AM

All replies

  • I solved the problem by adding Content-Type header.

    The resulted curl command line is like this.

    curl -X PUT -d '<ModelUpdateParams xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><Description>hello</Description><ActiveBuildId>1526289</ActiveBuildId></ModelUpdateParams>' -H "Content-Type: Application/xml" -H "Authorization: Basic ${AUTH_BASE64}" "${API_URL}UpdateModel?id=%27${MODEL_ID}%27&apiVersion=%271.0%27"

    Friday, June 19, 2015 2:52 AM
  • Thank you mhamanaka, you saved me a lot of time.
    Wednesday, July 29, 2015 9:30 PM