# Custom Onboarding API

## Get Custom Requirements

<mark style="color:blue;">`GET`</mark> `https://www.ondemandstaffing.app/api/v1/jobseeker/get_custom_onboarding`

This end points gets all the custom onboarding requirements relevant for a given Job Seeker.&#x20;

#### Query Parameters

| Name   | Type   | Description                                     |
| ------ | ------ | ----------------------------------------------- |
| tenant | string | The Tenant key for which the API is being used. |

#### Headers

| Name           | Type   | Description                                                                                                                                |
| -------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------ |
| Authentication | string | Authentication token to identify user who is requesting the custom onboarding. The user must be a Job Seeker with basic profile completed. |

{% tabs %}
{% tab title="200 Data Received:

Successful response is always an Array of Forms.
Each element in this array is a hash containing key information about the form: Including title, description and fields of the form.
Fields value is always an array of json.
Each field is uniquely identified by its 'key' property. When sending updates for the form or field, you must return the value of 'key' as 'custom\_requirement\_id'.
Field could be of type: Text input, dropdown, dropdown with other, checkbox, credentials to name a few.

Important: 'key' is the unique value that identifies each field. When updating the value for each field, you must submit the 'key' as 'custom\_requirement\_id' in the post request.

'label' is the question that needs to be asked to the user.
'type' indicates how this questions should be rendered in the form. The value could be any of the following: Dropdown, Freetext, Integer, File, Checkbox, Credential.
'options' only provided for field\_type Dropdown or CheckBox.
'items' indicates label and value pair for Dropdown or Checkbox.
'required\_level' indicates if the field is requierd or optional.
'description' is the helper text for the field. It contains html chracters and must be rendered accordingly. Example: link tags and other formatting.
'value' if the current user has some previous values for this field it would be provided here.

Handling Credentials
Key for credentials always start with: 'cert\_'

While regular fields just have one value. Credentials are mini form within themselves.
Credentials would also include required\_fields and hidden\_fields. Both indicate which of the following fields to be shown or not to be shown.

All Potential Fields that could be asked to candidate:  'certificate\_name' (MUST),  'issuing\_authority', 'issue\_date', 'expiry\_date', 'credential\_id', 'credential\_url','certificate\_file', 'geo\_level\_one'(List of States for US).

Other fields associated with the credentials are, that are not to be shown to candidate are:
is\_valid: states if the credential has been validated or not. Not to be shown to candidates.
cert\_request\_id: States if this credential is in response to a specific credential required by the platform. In most cases this will match the last section of the 'key' for a given credential. If this field is present in the response from server, you just need to include it back as is. No need to provide it if it is not included in the response from server.

" %}

```
[
    {
        "id": 3,
        "form_title": "Provide Emergency contact details",
        "form_description": "We use this information only in case of emergency.",
        "form_category": "standard",
        "custom_form_content": "**could contain rich text content**",
        "slug": "emergency-contact-2349",
        "fields":
        [
   {
      "key":12,
      "question":"Spanish Level?",
      "field_type":"Dropdown",
      "units":"ot",
      "options":[
         "Principiante",
         "  Intermedio",
         "  Avanzado",
         " No hablo"
      ],
      "required_level":"required",
      "description":null,
      "value":null
   },
   {
      "key":41,
      "question":"Height? ",
      "field_type":"Dropdown",
      "units":"in",
      "options":[
         "193 Cm",
         "194 Cm",
         "195 Cm",
         "196 Cm",
         "197 Cm",
         "198 Cm",
         "199 Cm",
         "200 Cm"
      ],
      "required_level":"required",
      "description":"",
      "value":"189 Cm"
   },
   {
      "key":42,
      "question":"Certificate?",
      "field_type":"File",
      "units":"ot",
      "required_level":"required",
      "description":"Please login to<a href='www.certificate.com'> this website </a> and prvoide your certificate.",
      "value":null
   },{
                "key": "cert_8",
                "label": "Wolf Platform Certified",
                "description": "Got trained on Wolf platform",
                "type": "credential",
                "required_fields": [
                    "certificate_file"
                ],
                "hidden_fields": [
                    "credential_url"
                ],
                "geography_scoped": null,
                "placeholder": "Wolf Platform Certified",
                "required": false,
                "id": "cert_8",
                "subject": "Wolf Platform Certified",
                "field_type": "custom",
                "country": 6,
                "value": {
                    "issue_date": "Nov 01, 2016",
                    "certificate_name": "Wolf Platform Certified",
                    "credential_id": "asdfasfsdds",
                    "id": "d54b51f3f0256d2d037f547ec6be930d",
                    "cert_request_id": "8"
                }
            }
]
}
]
```

{% endtab %}

{% tab title="401 Failed User authentication. " %}

```
{ status: 401  , data: { opertaion_status: 'Failed authorizing user'}, message: "Unaauthorized Access Attempt"}
```

{% endtab %}
{% endtabs %}

## Update Custom Requirement&#x20;

<mark style="color:green;">`POST`</mark> `https://www.ondemandstaffing.app/api/v1/jobseeker/get_custom_onboarding`

Post updates to custom requirements values for a given Job Seeker. \
\
To update it individually send the parameter 'custom\_requirement\_id'  and 'value'.\
To update the whole form send 'form\_submission' with an array of hashes containing \
'custom\_requirement\_id' and 'value'. Example below.&#x20;

#### Query Parameters

| Name                    | Type   | Description                                                                       |
| ----------------------- | ------ | --------------------------------------------------------------------------------- |
| form\_submission        | array  | Array of hashes with field id as: 'custom\_requirement\_id' and value as 'value'. |
| custom\_requirement\_id | string | Id of the custom requirement question which is being updated.                     |
| value                   | string | Value that user submitted or saved.                                               |
| tenant                  | string | Tenant Key for which the API is being used.                                       |

#### Headers

| Name           | Type   | Description                                                                                  |
| -------------- | ------ | -------------------------------------------------------------------------------------------- |
| Authentication | string | Authenticaation token to identify user who is requesting updating their custom requirements. |

{% tabs %}
{% tab title="200 Data successfully updated. " %}

```
{ status: 200  , data: { opertaion_status: 'Success'}, message: "Success"}
```

{% endtab %}

{% tab title="400 Missing Parameters. Either custom\_requirement\_id or value. " %}

```
{ status: 400  , data: { opertaion_status: 'Error'}, message: "Missing Parameters"}
```

{% endtab %}
{% endtabs %}

Sample Request updating one specific field:

```
{'custom_requirement_id': 323, 'value': 'test value'}
```

Sample request updating one specific credential:&#x20;

```
{'custom_requirement_id' : 'cert_23',
    'value': {
        "issue_date": "Nov 01, 2016",
        "certificate_name": "Wolf Platform Certified",
        "credential_id": "asdfasfsdds",
        "id": "d54b51f3f0256d2d037f547ec6be930d",
        "cert_request_id": "8"
  }
 }
```

Sample Request updating entire form:&#x20;

```
 {'form_submission': 
   [{'custom_requirement_id': 323, 'value': 'test value'},
    {'custom_requirement_id': 93, 'value': 'hello world'},
    {'custom_requirement_id' : 'cert_23',
    'value': {
        "issue_date": "Nov 01, 2016",
        "certificate_name": "Wolf Platform Certified",
        "credential_id": "asdfasfsdds",
        "id": "d54b51f3f0256d2d037f547ec6be930d",
        "cert_request_id": "8"
  }
   ]
 }
```
