Share quota (no group)
This POST operation shares plan quota from a specific donor to a list of recipients specified in the payload. If successful, you receive an HTTP response code of 200 and a JSON response listing the information along with an id.
| See HTTP response codes for other response codes. |
POST /sqs/api/donations + JSON request payload
HEADER INFO
authorisation: HTTP Basic Auth
tenant: <tenantName>
content-type: application/JSON
accept: application/JSON
By default, accept is XML. You must explicitly set accept in your header to application/JSON to receive a JSON response.
|
permissions: SQS_DONATION_PERMISSION
JSON request payload
The example below shares a certain quota amount with two recipients. This quota share comes out of the donor plan 456 from the donor 967178860. See SQS donations data type descriptions for more details on data types.
-
Specify
"quotaType": "amount"to share an exact amount.This is specified in bytes in the JSON request. However, subscribers typically share in MBfrom their mobile. -
Specify
"quotaType": "share"to share a percentage of a data plan.The percentage of quota shared is expressed as an integer between 0and10000000. So for example, 5% is 5/100 * 10000000 which equals500000which would be what you specify in the payload.
{
"donorId" : "967178860",
"donorPlanId" : 456,
"quotaType" : "amount",
"recipients" : [
{
"recipientId" : "123123",
"quota" : 1000000000
},
{
"recipientId" : "234234",
"quota" : 1500000000
}
]
}
{
"donorId" : "967178860",
"donorPlanId" : 456,
"quotaType" : "share",
"recipients" : [
{
"recipientId" : "123123",
"quota" : 500000
},
{
"recipientId" : "234234",
"quota" : 800000
}
]
}
JSON response
The JSON response includes the information passed in the JSON payload with an auto-assigned id.
{
"id": "Tv6pDuPz2Gm1Gax0zl7a",
"errorCode" : 0,
"recipients" : [
{
"errorCode" : 0,
"recipientId" : "123123"
},
{
"errorCode" : 0,
"recipientId" : "234234"
}
]
}
SQS donations data type descriptions
| Field | Type | Description | ||
|---|---|---|---|---|
|
string |
The auto-assigned ID given to a donation upon creation. |
||
|
string |
The MSISDN of the donor subscriber.
|
||
|
integer |
The ID of the donor’s shareable plan. |
||
|
string |
Specifies the quota type. This is
|
||
|
array |
An array that lists recipients of the donation. Recipients will have a |
||
|
string |
The unique ID for the recipient. This is typically the MSISDN.
|
||
|
integer |
The quota being shared with the recipient. |
||
|
string |
The unique ID of the group. Group IDs are auto-assigned upon creation. |
HTTP response codes
| Code | Description | ||||
|---|---|---|---|---|---|
|
success! |
||||
|
Multistatus response
|
||||
|
malformed request |
||||
|
unauthorised; bad username or password |
||||
|
forbidden; user does not have appropriate privileges |
||||
|
donor not found |
||||
|
conflict with target resource
|
||||
|
failed validation; this typically means that a property was not set or a value is out of range. example
|
||||
|
failed processing (after passing validation). example
Example 1. SQS response codes
|
||||
|
internal error |
||||
|
request rejected due to overload |