v1

Finish current operation

POST{yourserver}/finishActivation

This request is sent by the OnlineSIM server to close the current operation with a status that depends on its result.

By default, this request is sent when the operation time expires. It may also be sent earlier when the client closes the operation: after the SMS was received, or to cancel it without an SMS.

Status 1 is sent instead of 4 when the number has failed to receive an SMS from this service in three (or more) operations of your integration, including this one, or when the client reports the number as not working. It is a signal that the "number + service" pair will most likely fail again: you can use it to exclude the pair from issuance, or ignore it.

Request Body

Request payload from the OnlineSIM server

Content-Typeapplication/json
Schema
schemaobject
actionstringRequired
Method name, in this case FINISH_ACTIVATIONEnum:FINISH_ACTIVATIONExample:FINISH_ACTIVATION
activationIdintegerRequired
Operation ID (assigned by your server in GET_NUMBER)≥ 1Example:355
sumnumber
Sum credited to your balance for the operation, in RUB. Sent only by some integrationsExample:4.5
statusintegerRequired
Status code of the operation: 1 - no SMS received, and the number has failed to receive an SMS from this service in three (or more) operations, or the client reported it as not working. Check the number and service, it may be worth excluding the pair from issuance 3 - successfully sold (an SMS was received) 4 - cancelled, no SMS was receivedEnum:134Example:3
keystringRequired
API key of your OnlineSIM partner profileExample:apikey

Examples

sold

Closing a sold operation

{
  "action": "FINISH_ACTIVATION",
  "activationId": 75489,
  "status": 3,
  "key": "apikey"
}
cancelled

Closing an operation without an SMS

{
  "action": "FINISH_ACTIVATION",
  "activationId": 75490,
  "status": 4,
  "key": "apikey"
}

Responses

200The answer of your server to FINISH_ACTIVATION. Only status: SUCCESS closes the operation; for statuses 3 and 4 the answer {"status": "ERROR", "error": "record not found"} is accepted as closed too.
Content-Typeapplication/json
Schema
schemaobject
statusstringRequired
SUCCESS - the operation is closed on your side; anything else - the request will be repeatedEnum:SUCCESSERRORExample:SUCCESS
errorstring
Error text. record not found (unknown activationId) is accepted as closed for statuses 3 and 4Example:record not found

Examples

success

The operation is closed

{
  "status": "SUCCESS"
}
recordNotFound

Unknown operation (accepted as closed for statuses 3 and 4)

{
  "status": "ERROR",
  "error": "record not found"
}

Code Samples

Generating examples...