PUT api/EditBulk/{name}?user={user}

Generic method for object editing

Request Information

URI Parameters

NameDescriptionTypeAdditional information
name

Name of object

string

Required

user

Optional user handle - if empty logged in user will be used

string

None.

Body Parameters

Array of Edit details

Collection of Edit
NameDescriptionTypeAdditional information
IdList

List of ids to update or delete - empty for inserts

Collection of integer

Required

Data

List of data elements to modify/create

Dictionary of string [key] and string [value]

Required

Error

Details of error if edit fails

Error

None.

RowsAffected

Number of rows affected

integer

None.

NewId

Id of new object in case of insert

integer

None.

Request Formats

application/json, text/json

Sample:
[
  {
    "IdList": [
      1,
      2
    ],
    "Data": {
      "sample string 1": "sample string 2",
      "sample string 3": "sample string 4"
    },
    "Error": {
      "Code": 1,
      "Detail": "sample string 2",
      "Data": {}
    },
    "RowsAffected": 1,
    "NewId": 2
  },
  {
    "IdList": [
      1,
      2
    ],
    "Data": {
      "sample string 1": "sample string 2",
      "sample string 3": "sample string 4"
    },
    "Error": {
      "Code": 1,
      "Detail": "sample string 2",
      "Data": {}
    },
    "RowsAffected": 1,
    "NewId": 2
  }
]

application/xml, text/xml

Sample:
<ArrayOfEdit xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Namebay.Rest.Api.Models">
  <Edit>
    <Data xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
      <d3p1:KeyValueOfstringstring>
        <d3p1:Key>sample string 1</d3p1:Key>
        <d3p1:Value>sample string 2</d3p1:Value>
      </d3p1:KeyValueOfstringstring>
      <d3p1:KeyValueOfstringstring>
        <d3p1:Key>sample string 3</d3p1:Key>
        <d3p1:Value>sample string 4</d3p1:Value>
      </d3p1:KeyValueOfstringstring>
    </Data>
    <Error>
      <Code>1</Code>
      <Data />
      <Detail>sample string 2</Detail>
    </Error>
    <IdList xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
      <d3p1:long>1</d3p1:long>
      <d3p1:long>2</d3p1:long>
    </IdList>
    <NewId>2</NewId>
    <RowsAffected>1</RowsAffected>
  </Edit>
  <Edit>
    <Data xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
      <d3p1:KeyValueOfstringstring>
        <d3p1:Key>sample string 1</d3p1:Key>
        <d3p1:Value>sample string 2</d3p1:Value>
      </d3p1:KeyValueOfstringstring>
      <d3p1:KeyValueOfstringstring>
        <d3p1:Key>sample string 3</d3p1:Key>
        <d3p1:Value>sample string 4</d3p1:Value>
      </d3p1:KeyValueOfstringstring>
    </Data>
    <Error>
      <Code>1</Code>
      <Data />
      <Detail>sample string 2</Detail>
    </Error>
    <IdList xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
      <d3p1:long>1</d3p1:long>
      <d3p1:long>2</d3p1:long>
    </IdList>
    <NewId>2</NewId>
    <RowsAffected>1</RowsAffected>
  </Edit>
</ArrayOfEdit>

application/x-www-form-urlencoded

Sample:

Sample not available.

Response Information

Resource Description

List of Edit objects on success - each object has it's own information including an error object in case of errors
Collection of errors on failure
Return codes
200 - ok
400 - bad request
401 - unauthorized
404 - not found
500 - internal server error

Collection of Edit
NameDescriptionTypeAdditional information
IdList

List of ids to update or delete - empty for inserts

Collection of integer

Required

Data

List of data elements to modify/create

Dictionary of string [key] and string [value]

Required

Error

Details of error if edit fails

Error

None.

RowsAffected

Number of rows affected

integer

None.

NewId

Id of new object in case of insert

integer

None.

Response Formats

application/json, text/json

Sample:
[
  {
    "IdList": [
      1,
      2
    ],
    "Data": {
      "sample string 1": "sample string 2",
      "sample string 3": "sample string 4"
    },
    "Error": {
      "Code": 1,
      "Detail": "sample string 2",
      "Data": {}
    },
    "RowsAffected": 1,
    "NewId": 2
  },
  {
    "IdList": [
      1,
      2
    ],
    "Data": {
      "sample string 1": "sample string 2",
      "sample string 3": "sample string 4"
    },
    "Error": {
      "Code": 1,
      "Detail": "sample string 2",
      "Data": {}
    },
    "RowsAffected": 1,
    "NewId": 2
  }
]

application/xml, text/xml

Sample:
<ArrayOfEdit xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Namebay.Rest.Api.Models">
  <Edit>
    <Data xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
      <d3p1:KeyValueOfstringstring>
        <d3p1:Key>sample string 1</d3p1:Key>
        <d3p1:Value>sample string 2</d3p1:Value>
      </d3p1:KeyValueOfstringstring>
      <d3p1:KeyValueOfstringstring>
        <d3p1:Key>sample string 3</d3p1:Key>
        <d3p1:Value>sample string 4</d3p1:Value>
      </d3p1:KeyValueOfstringstring>
    </Data>
    <Error>
      <Code>1</Code>
      <Data />
      <Detail>sample string 2</Detail>
    </Error>
    <IdList xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
      <d3p1:long>1</d3p1:long>
      <d3p1:long>2</d3p1:long>
    </IdList>
    <NewId>2</NewId>
    <RowsAffected>1</RowsAffected>
  </Edit>
  <Edit>
    <Data xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
      <d3p1:KeyValueOfstringstring>
        <d3p1:Key>sample string 1</d3p1:Key>
        <d3p1:Value>sample string 2</d3p1:Value>
      </d3p1:KeyValueOfstringstring>
      <d3p1:KeyValueOfstringstring>
        <d3p1:Key>sample string 3</d3p1:Key>
        <d3p1:Value>sample string 4</d3p1:Value>
      </d3p1:KeyValueOfstringstring>
    </Data>
    <Error>
      <Code>1</Code>
      <Data />
      <Detail>sample string 2</Detail>
    </Error>
    <IdList xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
      <d3p1:long>1</d3p1:long>
      <d3p1:long>2</d3p1:long>
    </IdList>
    <NewId>2</NewId>
    <RowsAffected>1</RowsAffected>
  </Edit>
</ArrayOfEdit>