Updated on 2023-09-01 GMT+08:00

Creating an Instance

Description

After a customer purchases and pays for a product, KooGallery calls this API to ask you to create an instance.

  • You must return the unique ID (instanceId) of the order. Use the businessId provided by KooGallery to ensure that the instanceId is globally unique.
  • Do not block this API. If instance creation is time-consuming, create the instance asynchronously. You can generate an instance ID first and then return a response immediately. KooGallery will use the API for querying instance information to query the instance provisioning result.
  • For details about how to obtain order information, see KooGallery Open APIs.

    KooGallery may resend a request. For the same order ID (orderId) and order line (orderLineId), your server should return the same instanceId without creating a new SaaS instance.

    The following figure shows the process of creating an instance.

Request Message

The following table describes the request parameters. KooGallery initiates requests based on the sales mode of your product. You need to execute production based on the request information.

Request method: POST

Parameter

Mandatory

Type

Maximum Length

Description

activity

Yes

String

20

Request ID, which is used to distinguish the scenario.

For new subscriptions, the value is newInstance.

orderId

Yes

String

64

KooGallery order ID.

orderLineId

Yes

String

64

KooGallery order line ID.

businessId

Yes

String

64

KooGallery business ID.

The value of businessId is different for each request.

testFlag

No

String

2

Whether a request is submitted for debugging.

  • 1: debugging request.
  • 0: non-debugging request.

The default value is 0.

Example request:

curl -X POST 'https://www.isvwebsite.com/saasproduce?signature=11C4CD6279191DE931DEF5C51531DFFA9D37969F4E356B**********8&timestamp=1680508066618&nonce=50D83FDECAED6CCD8EF597F2A577950527928BA287D04E6036E92B2806FD17DA' -H 'Accept:application/json' -H 'Content-Type:application/json;charset=utf8' -d'{"activity":"newInstance","businessId":"87b947**********-69420d60e3c8","orderId":"CS221118******","orderLineId":"CS22111********-000001","testFlag":"0"}'

Response Message

The following table describes the response parameters.

Parameter

Mandatory

Type

Maximum Length

Description

resultCode

Yes

String

6

Invocation result code.

  • 000000: The resource is enabled synchronously.
  • 000004: The resource is enabled asynchronously.

For details, see Result Codes.

Return 0000004 if it takes a long time to create an instance. KooGallery will call the instance information query API to query the instance provisioning result.

resultMsg

No

String

255

Invocation result description.

instanceId

Yes

String

64

KooGallery business ID.

Example response:

{
    "resultCode":"000000", 
    "resultMsg":"success." , 
    "instanceId":"03pf80c2bae96vc49*********"
}